- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have code which does the following:
ThreadA():
AcquireSRWLockExclusive(lock);
SharedVar = someVal;
ReleaseSRWLockExclusive(lock);
...
ThreadB()
AcquireSRWLockShared(lock);
var = SharedVar;
ReleaseSRWLockShared(lock);
When I run the Intel Inspector to Locate Deadlocks and Data Races it says that there is read/write data race in accessing the presimably locked SharedVar. Does the Intel Inspector properly work with slim reader / writer locks or should I just discard the issue as a false positive?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Stefan,
did you first initialize slim reader/writer lock with InitializeSRWLock() function?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes. I did initialize the lock. Also i have a test which will detect if a reader thread accesses not fully written data. The test has been running for a day with no issues.
I've also tried the sample from "Synchronization Primitives New To Windows Vista" (http://msdn.microsoft.com/en-us/magazine/cc163405.aspx). The Intel Inspector detects a race condition in that code too (in updateValue() and getValue()).
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page