Cause PtMainLoop() in the calling thread to return
int PtQuitMainLoop( void );
ph
This function causes PtMainLoop() in the calling thread to return right after it finishes processing the current event.
PtQuitMainLoop() doesn't affect any modal operations that the thread is currently doing; if you call PtQuitMainLoop() from within a modal loop, there's no way for PtMainLoop() to return until after the modal loop has completed. |
Keep in mind that if you let your main() function return, exit() is called and your application is terminated without letting any widgets or threads do any cleaning up. It's better to call PtExit() instead -- the main purpose of PtQuitMainLoop()is to let you terminate threads running PtMainLoop() without terminating the application.
To ensure your application doesn't terminate, put a pthread_exit() call after the PtMainLoop() call in main(). In PhAB, changes to main() get overwritten by PhAB, so you should declare a global header for your application and map PtMainLoop() to your own function using a macro. For example:
#undef PtMainLoop void MyMainLoop( void ) { PtMainLoop(); pthread_exit(NULL); }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
“Threads” in the Parallel Operations chapter of the Photon Programmer's Guide