On Apr 15, 2006, at 3:52 AM, Jeffrey Mattox wrote:
1. Create a new project.
2. Add a PushButton.
3. Put this as the Action:
Dim sm as Semaphore
sm = new Semaphore
sm.Signal
sm.Signal
beep
Me.Caption = "bug"
4. Press the button.
It should block on the second sm.Signal, but it falls right through
and beeps. Is it me, or an RB bug?
I believe this is because signal works on a thread level. Once you
call signal from a thread, in this case the main thread and no other
resource has a lock on your semaphore, then the signal call simply
returns and puts a lock that belongs to your thread on the semaphore.
The second time you call signal from the same thread, your thread
already has the lock so signal does not block and you are free to
continue. I think you need to test this with at least one other
thread to see it in action. I haven't tested this myself in a while,
but I believe what I stated is correct. I'm sure someone will chime
in if I'm mistaken.
Kevin
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>