Hi,
I have two threads which capture and display video on LCD. One thread captures the buffer does appropriate conversion(worker thread) and the other displays it on the label(GUI thread). I have a signal emitted when the worker thread is ready with the buffer. This calls a slot in the GUI thread.
1) I understand that the signal and slot mechanism is sequential. So the slot will be executed asa the signal is emitted and the execution of the worker thread will continue only after the slot returns. I pass the buffer reference in the signal. But my video gets cut in this case. It seems as if both are working on it simultaneously. why so?
2) I tried using a QMutex to lock the buffer to avoid such a condition. But something weird happens. In the run method of the worker thread i have checked a STOP flag in while loop. If its true then the function should do nothing. But surprisingly when i stop the thread (by button click) the thread exists in between the execution of run in while () just after it has applied the mutex. Due to this the releasing of all the buffer doesnt happen leading to seg fault!!!
Please help.
Thanks in advance.
Bookmarks