In a plugin I run several threads. However, the program that the plugin accesses is single threaded. I need a way to call functions in the program from the 'main' thread, not the new threads. I can't find a POSIX function (pthread) that allows me to call a function in the main thread from the child thread.
Does anyone know of a function?
There is none. Pthreads doesn't have call injection. All you can do is queue up whatever you want to do and wait for the main thread to call your plugin again, then handle all the calls back into the program.