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