disallowed semaphore removal from a group when a process is waiting for the semaphore to be signaled

This commit is contained in:
hyunghwan.chung
2017-11-03 16:26:55 +00:00
parent f7272c00fb
commit 27c2c5b404
4 changed files with 33 additions and 12 deletions

View File

@ -218,7 +218,7 @@ method(#class,#abstract) xxx. => method(#class) xxx { self subclassResponsibilit
{
| x |
x := self _addSemaphore: sem.
if (x isError) { thisProcess primError dump. Exception signal: ('Cannot add a semaphore - ' & thisProcess primError) }.
if (x isError) { Exception signal: ('Cannot add a semaphore - ' & x asString) }.
^x
}
@ -226,7 +226,7 @@ method(#class,#abstract) xxx. => method(#class) xxx { self subclassResponsibilit
{
| x |
x := self _removeSemaphore: sem.
if (x isError) { thisProcess primError dump. Exception signal: ('Cannot remove a semaphore - ' & thisProcess primError) }.
if (x isError) { Exception signal: ('Cannot remove a semaphore - ' & x asString) }.
^x
}
@ -234,7 +234,7 @@ method(#class,#abstract) xxx. => method(#class) xxx { self subclassResponsibilit
{
| x |
x := self _wait.
if (x isError) { thisProcess primError dump. Exception signal: ('Cannot wait on a semaphore - ' & thisProcess primError) }.
if (x isError) { Exception signal: ('Cannot wait on a semaphore - ' & x asString) }.
if (x signalAction notNil) { x signalAction value: x }.
^x
}

View File

@ -33,6 +33,7 @@ class MyObject(Object)
s3 := Semaphore new.
sg := SemaphoreGroup new.
sg addSemaphore: s1.
sg addSemaphore: s2.
sg addSemaphore: s3.