Click to See Complete Forum and Search --> : Is Thread Overlapping ??


softmessager
August 21st, 2005, 08:55 AM
I am working with image processing.
The Software does a visual inspection of finished products that are coming 220 units per minute. There three cam's taking 2 side and one top image for the same.
I have two triggers that executes three inspection threads (for three cameras) .
The first trigger executes the first side inspection thread and the second trigger (seosnr) begins 2 inspectionthreads .. that is .. for the other side station and the top station.
After some point (say 10 minutes) the 2 threads initiated by the second sensor seems to gets mized up.
the symptoms, the second side image seems to be viewed as enlarged image and the top image seems to get stuck.
The inspection at these two stations seems to get halted. and the units just pass over without getting imspected.
There is no memory leakage. and I am using open CV algorithams.

Is there is a posibility that these two threads seem to overlap ?? if so why ? and how to solve this ?

Siddhartha
August 21st, 2005, 09:22 AM
When you are using a multi-threaded application, it is often important to synchronize threads that read / write from the same memory location.

As a thumb rule, a memory location (i.e. a shared object) should be written to by only one thread at a time. You can make other threads wait when one thread writes using Critical Sections.

As your question is very general, I would recommend you to read these links:

MSDN


Synchronization (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/synchronization.asp)
Synchronization Reference (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/synchronization_reference.asp)
Synchronization Functions (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/synchronization_functions.asp)
Codeguru FAQs

How to create a worker thread? (http://www.codeguru.com/forum/showthread.php?t=312452)
How to end a thread? (http://www.codeguru.com/forum/showthread.php?t=305166)
How to use member functions as thread functions? (http://www.codeguru.com/forum/showthread.php?t=312453)
How to access UI elements from a thread in MFC? (http://www.codeguru.com/forum/showthread.php?t=312454)
Codeguru Articles

Win32 Thread Synchronization (http://www.codeguru.com/Cpp/W-P/win32/tutorials/article.php/c9823/)

Siddhartha
August 21st, 2005, 09:24 AM
[ moved ]

Regards,
Siddhartha