added the equality(=) method to Array.

fixed the equality primitive handler to accept the subclasses of Semaphore/SemaphoreGroup
This commit is contained in:
hyunghwan.chung
2017-10-02 01:22:49 +00:00
parent c412097f6f
commit a54c2e21f2
6 changed files with 112 additions and 60 deletions

View File

@ -62,46 +62,11 @@ class Semaphore(Object)
var(#get,#set) _group := nil.
method(#class) forMutualExclusion
{
| sem |
sem := self new.
sem signal.
^sem
}
## ==================================================================
method(#primitive) signal.
method(#primitive) wait.
(*
TODO: timed wait...
method waitWithTimeout: seconds
{
| s |
s := Semaphore new.
Processor signal: s after: seconds.
self waitWithTimedSemaphore: s.
if (self.
}
method waitWithTimeout: seconds and: nanoSeconds
{
<primitive: #_semaphore_wait>
self primitiveFailed
}
*)
(* TODO: MIGRATE TO MUTEX...
method critical: aBlock
{
self wait.
^aBlock ensure: [ self signal ]
}*)
## ==================================================================
method heapIndex
@ -145,8 +110,14 @@ class Mutex(Semaphore)
^s.
}
method lock { ^self wait }
method unlock { ^self signal }
(*
TODO: how to prohibit wait and signal???
method(#prohibited) wait.
method(#prohibited) signal.
*)
method lock { ^super wait }
method unlock { ^super signal }
method critical: block
{