I just looked at both code example (after putting it on NTTALK). Just to see what could be problems as an exercise. After couple false alarm, what I found is this …
max’s code works fine. Consumers does the job of Reseting, hence put them in waiting mode if there is no work. The behavior is - All the consumers can be runnable even though just one work item is in the list. Then they will go on blocking, since the consumer that gets the item will reset the event… __Essentially it is a minor point, but if someone has say 64 consumer threads, worst it can see is all 64 runnable, scheduled, then go to sleep for lack of work.
anton’s code: tried counters and flags, but lack of a Reset can make every one runnable after initial starts, they would spin for work… so it isn’t there for a semaphore type behavior yet.
-pro
On Dec 13, 2010, at 6:01 AM, xxxxx@fastmail.fm wrote:
Windows is not Unix, Windows semaphores are not posix semaphores.
– pa
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminarsTo unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer