|
-
July 3rd, 2011, 09:06 AM
#8
Re: Win32/queue(STL)/threads?
Any memory locations (variables) that are accessed by two or more threads must be protected by synchronization primitives. The only exception is if all accesses are read-only for the entire duration of all threads.
Everywhere you see "pEventQueue" being accessed outside the protection of "ccQueueWrite" is undefined behavior.
Here's an even better example, that also demonstrates proper overlapped I/O using ReadDirectoryChanges: http://cboard.cprogramming.com/windo...tml#post966940
Take my code. Understand/Change/Use it. Post any questions you may have.
gg
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
|