I have a general question about a threads and callbacks. Say for example we have a thread running continuously along with the main program.
The main program has registered a callback function with the thread. So the thread can call the callback function at any time. Generally, we register a callback by passing a function pointer to the thread.I want to know when that callback function is called by the thread, will it be a part of that thread or, will it be part of the main program. I want to know the mechanism of this process like how the main program execution is stopped or interrupted when the callback is called by the thread. Another thing is how will the function call stack behave when the callback is called.