Hi all,
Here is my problem :
void* startOF(void*)
{
ofAppGlutWindow window;
ofSetupOpenGL(&window, 800,600, OF_WINDOW);
// ofWindow is derived from ofBaseApp
// there comes the actual question :
ofRunApp(new ofWindow());
/**/std::cout<<"exit of_thread"<< std::endl;
pthread_exit(NULL);
}
int main (int argc, char** argv)
{
// openFrameworks thread
pthread_t of_thread;
pthread_create(&of_thread, NULL, startOF, NULL);
// another thread
struct qt_argxs args = {argc, argv};
pthread_t qt_thread;
pthread_create(&qt_thread, NULL, startQt, &args);
// end of program
pthread_join(qt_thread, NULL);
pthread_join(of_thread, NULL);
return 0;
}
As you can see, I have two threads in my app, and one is for openFrameworks. I would like to use pthread_join() to synchronise my app. When I close the openFramework window, the cout is not displayed. I might be wrong, but I think ofRunApp never returns, and therefor I never reach my “pthread_exit(NULL);”.
What would be the proper way to do what I want to do (this implies keeping openFramework in a separated thread ;D ) ?