I have a Photon application created with PhAB showing 2 camera images at the same time.
The frame grabber API calls a function every time it has a new capture. This function increment a semaphore, for wich a thread is blocked on, and returns (because the FG callback has to be very fast so it can start a new capture). When the sem_wait in each thread unblocks, it renders the image in the GUI. The drawing function calls PtEnter and PtLeave to lock Photon library.
Sometimes (20-30%)when the window is closed and the “window closing” callback cancels the image threads, the #1 thread (the GUI thread) closes the main window but remains blocked on a MUTEX. I guess that this is because one of the image threads is cancelled after a PtEnter(), but before it calls PtLeave()… but I’m not sure because I have a pthread_setcancelstate(…) to prevent each thread of being cancelled when drawing
I forgot to mention that I am not using any other mutex than the PtEnter/PtLeave calls.