Click here to Skip to main content
15,915,501 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish28-Jun-08 15:37
Kiran Satish28-Jun-08 15:37 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery28-Jun-08 16:16
Mark Salsbery28-Jun-08 16:16 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish28-Jun-08 16:21
Kiran Satish28-Jun-08 16:21 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery29-Jun-08 7:03
Mark Salsbery29-Jun-08 7:03 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery29-Jun-08 7:26
Mark Salsbery29-Jun-08 7:26 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish29-Jun-08 8:33
Kiran Satish29-Jun-08 8:33 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery29-Jun-08 8:48
Mark Salsbery29-Jun-08 8:48 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish30-Jun-08 10:36
Kiran Satish30-Jun-08 10:36 
I have a question, I tried to implement the same thing in my application (with some difference, in our application we can not grab frame while processing the current image as we have to update other hardware before grabbing next frame). Here is what I tried to do, I have a camera thread and my loop thread. The loop thread waits for the Camera thread to get a new frame and once the camera gets new frame, it waits for the loop thread until it process and signals it to get next frame. Thats the basic idea. After doing the current image analysis and changing the hardware status based upon current image analysis results, I spend around 6-8ms to update some displays and do some logs, so I thought I can signal the camera meanwhile to get new frame. But I am stuck with deadlocks with signal flags between threads.

Loop thread
do{
if (newframe){
do analysis on the frame
signal = true;//signal the camera to get new frame
update displays and do logs for the current frame
}
}while(looprunning);

camera thread
do{
if (signal){
newframe = false;
get new frame - takes 20ms
newframe = true;
signal = false;
}
}while(camrunning);


I can see an obvious deadlock, how can I get around this problem Confused | :confused: ?

-thanks

PKNT

GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery30-Jun-08 10:53
Mark Salsbery30-Jun-08 10:53 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish30-Jun-08 11:00
Kiran Satish30-Jun-08 11:00 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery30-Jun-08 11:03
Mark Salsbery30-Jun-08 11:03 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery30-Jun-08 11:05
Mark Salsbery30-Jun-08 11:05 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish30-Jun-08 13:12
Kiran Satish30-Jun-08 13:12 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery30-Jun-08 19:08
Mark Salsbery30-Jun-08 19:08 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish1-Jul-08 6:04
Kiran Satish1-Jul-08 6:04 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery1-Jul-08 6:39
Mark Salsbery1-Jul-08 6:39 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish1-Jul-08 6:53
Kiran Satish1-Jul-08 6:53 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery1-Jul-08 6:57
Mark Salsbery1-Jul-08 6:57 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish1-Jul-08 7:01
Kiran Satish1-Jul-08 7:01 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery1-Jul-08 7:09
Mark Salsbery1-Jul-08 7:09 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish1-Jul-08 7:05
Kiran Satish1-Jul-08 7:05 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery1-Jul-08 7:18
Mark Salsbery1-Jul-08 7:18 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish1-Jul-08 12:38
Kiran Satish1-Jul-08 12:38 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery1-Jul-08 13:34
Mark Salsbery1-Jul-08 13:34 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish1-Jul-08 14:48
Kiran Satish1-Jul-08 14:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.