added Semaphore>>forMutualExclusion

This commit is contained in:
hyunghwan.chung
2016-05-18 15:10:00 +00:00
parent 04ccebe9b4
commit 50776d945f
2 changed files with 18 additions and 14 deletions

View File

@ -68,6 +68,14 @@
{
#dcl count waiting_head waiting_tail heapIndex fireTimeSec fireTimeNsec.
#method(#class) forMutualExclusion
{
| sem |
sem := self new.
sem signal.
^sem
}
#method initialize
{
self.count := 0.
@ -104,11 +112,8 @@
#method critical: aBlock
{
## TODO: implement this
"
self wait.
^aBlock ensure: [ self signal ]
"
}
## ==================================================================