Prob on Multi-Threaded Application
-
Hi Friends, I am working with a multithreaded application. The problem which i am facing is sometimes the application shutdown is not proper (seems that the application is in waiting state). I am using CriticalSection also for data sync. Is there any tool which shows the current thread status..etc. Sujan Note: i do have the process explorer from sysinternals.com. In the process viewer it is showing that the application is waiting on the ntdelayexecution thread.
-
Hi Friends, I am working with a multithreaded application. The problem which i am facing is sometimes the application shutdown is not proper (seems that the application is in waiting state). I am using CriticalSection also for data sync. Is there any tool which shows the current thread status..etc. Sujan Note: i do have the process explorer from sysinternals.com. In the process viewer it is showing that the application is waiting on the ntdelayexecution thread.
Are you using WaitForX (Single Object, MultipleObjects) or MsgWaitForX (same thing) at all? More than one critical section, leading to a deadlock situation?. Otherwise, your applciaiton wants to exit, but one or more of your threads are still blocked waiting for a mutex, event, etc. You should design your threads to wait for MORE than one object, typically the processing object, and an event object you can 'set' from the main thread when the program is about to exit. Then when progrma is about to exit, it signals event for thread(s) to exit, waits for thread(s) to exit, and then the main program's thread can exit. How do you detect that a thread has exited? The thread can set an event the main thread is waiting on, the thread can clear/set a variable the main thread can check, or main thread can wait for thread handle to be signaled. see documentaiton for _beginthreadex