-
August 16th, 2015, 07:59 PM
#1
seemingly dead lock with thread pool library
http://www.codeproject.com/Articles/637708/Thread-Pool
I am right now using this library.
I simply create 2 parallel threads to deal with pathfinding problem.
In my findPath function which is triggered from one of the spawned threads,
has a std::lock_guard<mutex>(mu); line of code
this mu is located in the class scope.
I find it, but not sure, the thread freezed sometimes at arbitrary locations within this thread.
I don't want to, but as to keep things modular, I want to call user-functions within threads.
I know I didn't lock another mutex in the user functions.
But why is the mutex dead-locked?
2 threads may interweave the calling to the method, but one of them will get blocked, until the other releases it
Shouldn't be locking at all. But a matter of fact it is. Could the reason be just too slow to observe the consequences of the programs rather than assuming it is locked. When I carry the thread in the debugger,
it walks thru nicely, but when I let it run freely, it locks.
Thanks
Jack
Last edited by lucky6969b; August 17th, 2015 at 03:29 AM.
Reason: Previous problem resolved.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|