From cd327140995aedadbf0b27f1e8024b3046860441 Mon Sep 17 00:00:00 2001
From: Chris Double
Date: Wed, 21 Sep 2005 02:15:29 +0000
Subject: [PATCH] change concurrency library to use new catch usage
---
.../concurrency/concurrency-examples.factor | 12 ++++++------
contrib/concurrency/concurrency-tests.factor | 3 +--
contrib/concurrency/concurrency.factor | 2 +-
contrib/concurrency/concurrency.html | 18 +++++++++---------
4 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/contrib/concurrency/concurrency-examples.factor b/contrib/concurrency/concurrency-examples.factor
index 705a8492a7..96e31e8662 100644
--- a/contrib/concurrency/concurrency-examples.factor
+++ b/contrib/concurrency/concurrency-examples.factor
@@ -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 )
diff --git a/contrib/concurrency/concurrency-tests.factor b/contrib/concurrency/concurrency-tests.factor
index 6734571716..498bffdc3a 100644
--- a/contrib/concurrency/concurrency-tests.factor
+++ b/contrib/concurrency/concurrency-tests.factor
@@ -164,8 +164,7 @@ USING: kernel concurrency concurrency-examples threads vectors
] spawn-link drop
receive
]
- [
- ] catch
+ catch
] unit-test
[ 50 ] [
diff --git a/contrib/concurrency/concurrency.factor b/contrib/concurrency/concurrency.factor
index f64dd22277..7de9930ac0 100644
--- a/contrib/concurrency/concurrency.factor
+++ b/contrib/concurrency/concurrency.factor
@@ -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
diff --git a/contrib/concurrency/concurrency.html b/contrib/concurrency/concurrency.html
index baa97bd1f8..f2d92806a2 100644
--- a/contrib/concurrency/concurrency.html
+++ b/contrib/concurrency/concurrency.html
@@ -349,9 +349,9 @@ can catch it:
"This will not print" print
] spawn-link drop
receive
-] [
- [ "Exception caught." print ] when
-] catch
+]
+catch [ "Exception caught." print ] when
+
=> "Exception caught."
Exceptions are only raised in the parent when the parent does a
@@ -427,12 +427,12 @@ worker:
[
#! 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 )