If thread B just tried to bump the semaphore up twice before A started
waiting, the second increment will raise an exception - check if you are
catching exceptions in thread B. Unless you have used some other
synchronization mechanism, you can't really prevent this - how do you
know in B when to signal the semaphore again? Does A signal an event
that B uses to wake up and call KeReleaseSemaphore() ? Take a hard look
at that.
Dumping semaphore state is easy - semaphores have a DISPATCHR_HEADER -
dump the second ULONG it points to, that is the signal state.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ken Steinberg @
Interpose
Sent: Wednesday, November 10, 2004 10:59 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Feeling stupid today.....Single Count Semaphore
Agreed....the semaphore will actually have a higher limit later...I am
just testing...
Thanx...feeling less (sort of) stupic
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Roddy, Mark
Sent: Wednesday, November 10, 2004 1:53 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Feeling stupid today.....Single Count Semaphore
My thought is that you have some other bug that is clobbering your
semaphore logic. However I also continue to insist that a simpler
mechanism would suffice in your case.
=====================
Mark Roddy
From: Ken Steinberg @ Interpose [mailto:xxxxx@interposellc.com]
Sent: Wednesday, November 10, 2004 1:35 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Feeling stupid today.....Single Count Semaphore
Yes, so as you see it there is no reason for my logic not to continually
work....
I cant understand why I can't continue just going up and down....
thoughts?
Ken
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Roddy, Mark
Sent: Wednesday, November 10, 2004 1:25 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Feeling stupid today.....Single Count
Semaphore
The wake wakeup consumes one count, returning it to zero and the
semaphore to an unsignaled state. A subsequent release will once again
set the semaphore to a signaled state. Offhand I can't think of a good
reason to use a binary semaphore with a limit of one rather than an
event or some other simpler mutex-like object.
=====================
Mark Roddy
From: Ken Steinberg @ Interpose
[mailto:xxxxx@interposellc.com]
Sent: Wednesday, November 10, 2004 1:09 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Feeling stupid today.....Single Count Semaphore
Ok,
I just need to confirm that I am being an idiot and not
misunderstanding...
Strangest thing....
- in thread A initialize a semaphore using
KeInitializeSemaphore, count=0, limit=1....
- then Thread A does a KeWaitForSingleObject()
- Thread B does a KeReleaseSemaphore(), adjustment=1
- Thread A wakes up, waves at me and goes back to sleep on a
KeWaitForSingleObject()
from here Thread B cannot wake up Thread A again...this logic
only works once...
someone tell me how I am being stupid please!
Kenneth D. Steinberg
Interpose LLC
Chief Technical Officer/Founder
400 Bedford St
Manchester, NH 03101
xxxxx@interposellc.com
www.interposellc.com http:</http:>
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ''
To unsubscribe send a blank email to
xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as:
xxxxx@interposellc.com
To unsubscribe send a blank email to
xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument:
''
To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@interposellc.com To
unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com