change concurrency library to use new catch usage

cvs
Chris Double 2005-09-21 02:15:29 +00:00
parent 6b4227b022
commit cd32714099
4 changed files with 17 additions and 18 deletions

View File

@ -128,12 +128,12 @@ M: crash-command run-rpc-command ( command -- shutdown? result )
: (robust-rpc-server) ( worker -- )
[
receive over send
] [
[
"Worker died, Starting a new worker" print
drop [ handle-rpc-message ] spawn-linked-server
] when
] catch
]
catch
[
"Worker died, Starting a new worker" print
drop [ handle-rpc-message ] spawn-linked-server
] when
(robust-rpc-server) ;
: robust-rpc-server ( -- process )

View File

@ -164,8 +164,7 @@ USING: kernel concurrency concurrency-examples threads vectors
] spawn-link drop
receive
]
[
] catch
catch
] unit-test
[ 50 ] [

View File

@ -209,7 +209,7 @@ TUPLE: linked-exception error ;
#! Same as spawn but if the quotation throws an error that
#! is uncaught, that error gets propogated to the process
#! performing the spawn-link.
[ [ [ rethrow-linked ] when* ] catch ] cons
[ catch [ rethrow-linked ] when* ] cons
[ in-thread ] self make-linked-process [ with-process ] over slip ;
#! A common operation is to send a message to a process containing

View File

@ -349,9 +349,9 @@ can catch it:</p>
"This will not print" print
] spawn-link drop
receive
] [
[ "Exception caught." print ] when
] catch</span>
]
catch [ "Exception caught." print ] when
</span>
=> "Exception caught."
</pre>
<p>Exceptions are only raised in the parent when the parent does a
@ -427,12 +427,12 @@ worker:</p>
[
#! Forward all messages to worker
receive over send
] [
[
"Worker died, Starting a new worker" print
drop [ handle-rpc-message ] spawn-linked-server
] when
] catch
]
catch
[
"Worker died, Starting a new worker" print
drop [ handle-rpc-message ] spawn-linked-server
] when
(robust-rpc-server) ;
: robust-rpc-server ( -- process )