[BUG] {almost-fix} Semaphore>>critical: is broken
Paul McDonough
wnchips at yahoo.com
Wed Oct 11 22:05:46 UTC 2000
Try this snippet:
| foo |
Semaphore critical: [^foo]
... this should hang Squeak pretty nicely, because the
Semaphore will never get signaled.
The fix is pretty straightforward (see below), but it
depends on #ensure:, which afaik is also broken in the
main release stream. So if you have the
recently-passed-around exceptions/unwind/etc. fix-up,
then you will want this Semaphore change. Otherwise,
best not try it, as a Squeak hang-up is probably
preferable to the caliber of surprise you'll get when
^-returns go astray ... ;-).
If you prefer to wait a bit, both the exceptions/etc.
and this tweak will appear in the first batch of
Stable Squeak code.
---------------------------------------------------
'From Squeak2.8 of 30 June 2000 [No updates present.]
on 11 October 2000 at 2:56:54 pm'!
!Semaphore methodsFor: 'mutual exclusion' stamp: 'pnm
10/11/2000 14:38'!
critical: mutuallyExcludedBlock
"Evaluate mutuallyExcludedBlock only if the receiver
is not currently in
the process of running the critical: message. If the
receiver is, evaluate
mutuallyExcludedBlock after the other critical:
message is finished."
| blockValue |
[self wait.
blockValue := mutuallyExcludedBlock value]
ensure: [self signal].
^blockValue! !
__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
More information about the Squeak-dev
mailing list
|