Problem with a single-threaded application

Hi all

I have an application running a processe, from this process i want to call functions and within these function i want to start a new thread processing Photon routine. Only one thread will be create at once. When the thread will finish, the library function will call a new thread processing other photon routine. Also i dont want to block my main process when i call the graphical function library. The order of the thread called by the graphical function will be read from a configuration file. The main thread is a resmgr, so i dont want to block in a PtMainLoop or any other loop from photon. When i use PtInit on the first Thread created, i cant use it anymore on any other thread. The only way i’ve figured out to create other widget and window in the next thread is to use PtEnter and PtLeave, but in the Photon programmer’s guide, these functions are described to be use in a multi-thread application. Did i miss something ?

Other question… is there a way to use the code generated by Phab in a thread ? I’ve tryed many things but i can’t use ApInitialize or ApInitapp outside of the main. These function need a context to work properly so i can’t use the code outside the main (abmain.c).


AFAIK, there is no getting away from the PtEnter() PtLeave() thing, I’ve tried doing stuff without them and it just crashes. My own workaround was to run two seperate apps, one for the processing and one for the display, and communicate with message passing, and pass data in shared memory.

I don’t know about the PhAb stuff, but as the two functions you mention are not in the docs on, maybe you’re not supposed to use them yourself…