L
Lee Crabtree
Is there any way to find out on which core of a multi-core machine a
thread is executing?
Here's the rationale behind such a question. Maybe it's wrong, I'm not
sure. The app we've written communicates with some USB devices through
a wrapped DLL that SHOULD handle thread safety (locking and suchlike).
However, we've had some very strange, sporadic, and unpredictable bugs,
and one of the places we decided to look first was the multithreaded
areas, as that's a pretty common place for things to blow up unexpectedly.
Here's where the speculation occurs.
After some research, I discovered that the lock keyword (and by
association, the Monitor class) does NOT apply across processes. My
theory, then, is that a thread running on a different core might not be
locking like we think it should. The fix for that would be to use a
Mutex object or switch to a message/response queue system instead of
using the lock keyword, but before I go in and start replacing things,
I'd like to find out if my theory holds any water.
DC
thread is executing?
Here's the rationale behind such a question. Maybe it's wrong, I'm not
sure. The app we've written communicates with some USB devices through
a wrapped DLL that SHOULD handle thread safety (locking and suchlike).
However, we've had some very strange, sporadic, and unpredictable bugs,
and one of the places we decided to look first was the multithreaded
areas, as that's a pretty common place for things to blow up unexpectedly.
Here's where the speculation occurs.
After some research, I discovered that the lock keyword (and by
association, the Monitor class) does NOT apply across processes. My
theory, then, is that a thread running on a different core might not be
locking like we think it should. The fix for that would be to use a
Mutex object or switch to a message/response queue system instead of
using the lock keyword, but before I go in and start replacing things,
I'd like to find out if my theory holds any water.
DC