I have a secondary thread running some code in a loop and i want it to send a callback to the main thread every N loop cycles.
I pass the callback function as a pointer void (*loop_callback)(uint);
that i pass to the thread on creation.
How would i call the callback function from the secondary thread on both linux and windows (i use pthread to spawn the thread on linux and CreateThread on windows)? I want it to run on the main thread so that the secondary thread would not wait for the execution to end. I cannot have the main thread wait in a loop either.