I need to have my program A which contains the main function wait on a signal from a function from a class B so that the main function can fall through to the return statement to end the program.
I don't want to use a while loop though. I want program A to sleep and stop all activity so that it does not consume cpu time and then whenever object B needs to end the program, it would signal A somehow. I know how to use callback functions but how would the function access things inside the main function??? Any idea how to do this. Thanks a bunch.