Thread blocking
-
I have some thread in my project that on of them is blocked but I don't know in which line in my code the thread have been blocked. how can I know where my thread is blocked?
Agh
mehrdadov wrote:
how can I know where my thread is blocked?
Try stopping it in the debugger and then checking where each of your threads is.
I enjoy occasionally wandering around randomly, and often find that when I do so, I get to where I wanted to be [^]. Awasu 2.3 [^]: A free RSS/Atom feed reader with support for Code Project. 50% discount on the paid editions for CP members!
-
I have some thread in my project that on of them is blocked but I don't know in which line in my code the thread have been blocked. how can I know where my thread is blocked?
Agh
-
mehrdadov wrote:
how can I know where my thread is blocked?
Try stopping it in the debugger and then checking where each of your threads is.
I enjoy occasionally wandering around randomly, and often find that when I do so, I get to where I wanted to be [^]. Awasu 2.3 [^]: A free RSS/Atom feed reader with support for Code Project. 50% discount on the paid editions for CP members!
-
Also, insert TRACE lines inside the thread and see which one is not getting called.
-- ===== Arman
-
But when a thread is stoped I can't understand where it's stoped even if it was in debugger if you know a approach please help me
Agh
If you're using VC6: - In the Debug menu you will find a Threads menu item. This lets you switch between the threads in your program. - Look at the call stack (View|Debug Windows) to see the stack for the current thread. Other versions of VS will have something similar.
I enjoy occasionally wandering around randomly, and often find that when I do so, I get to where I wanted to be [^]. Awasu 2.3 [^]: A free RSS/Atom feed reader with support for Code Project. 50% discount on the paid editions for CP members!
-
My thread is main thread so I can't search only in one function and If I set TRACE function for all of class it can't work successfully because It need a lot of CPU time
Agh
As Taka mentioned, break the execution when you think a thread is deadlocked. In the Debug/Threads window, double click on each of your app's threads. That sets the debugger's focus to that thread and brings the source code up with the current execution pointer shown. If it's pointing at a wait function, it's probably stopped right there. If a dialog pops up stating there's no source code available then look at the stack trace and go back to the nearest line of code you find that is in your source code. That will be the current call in progress on that thread. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder