added some experimental code
This commit is contained in:
@@ -160,7 +160,11 @@ method(#class,#abstract) xxx. => method(#class) xxx { self subclassResponsibilit
|
||||
{
|
||||
| x |
|
||||
x := self _wait.
|
||||
if (x signalAction notNil) { x signalAction value: x }.
|
||||
if (x notError)
|
||||
{
|
||||
## TODO: is it better to check if x is an instance of Semaphore/SemaphoreGroup?
|
||||
if (x signalAction notNil) { x signalAction value: x }.
|
||||
}.
|
||||
^x
|
||||
}
|
||||
|
||||
|
||||
@@ -612,7 +612,7 @@ error -> exception
|
||||
].
|
||||
|
||||
[
|
||||
| s s2 st |
|
||||
| s s2 st sg |
|
||||
[
|
||||
s := Socket domain: Socket.Domain.INET type: Socket.Type.STREAM.
|
||||
##s connect: (SocketAddress fromString: '127.0.0.1:9999') do: conact.
|
||||
@@ -624,13 +624,25 @@ error -> exception
|
||||
## ###s2 listen: 10; watchInput.
|
||||
## s2 listen: 10 do: accact.
|
||||
|
||||
st := Semaphore new.
|
||||
System addAsyncSemaphore: st.
|
||||
System signal: st afterSecs: 5.
|
||||
'JJJJJJJJJJJ' dump.
|
||||
sg := SemaphoreGroup new.
|
||||
'JJJJJJJJJJJ' dump.
|
||||
sg wait.
|
||||
'YYYYYYYYYYYYYYY' dump.
|
||||
|
||||
###[ while (1) { '1111' dump. System sleepForSecs: 1 } ] fork.
|
||||
|
||||
st := Semaphore new.
|
||||
System addAsyncSemaphore: st.
|
||||
System signal: st afterSecs: 20.
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (System handleAsyncEvent isError) { break }.
|
||||
}.
|
||||
|
||||
]
|
||||
ensure:
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user