! Copyright (C) 2003, 2010 Slava Pestov, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays calendar combinators
-combinators.short-circuit concurrency.combinators
-concurrency.count-downs concurrency.flags
-concurrency.semaphores continuations debugger destructors fry
-io io.sockets io.sockets.secure io.streams.duplex io.styles
-io.timeouts kernel logging make math math.parser namespaces
-present prettyprint random sequences sets strings threads ;
+USING: accessors arrays calendar concurrency.flags
+concurrency.semaphores continuations destructors io io.sockets
+io.sockets.secure io.streams.duplex io.styles io.timeouts kernel
+logging make math namespaces present prettyprint random
+sequences sets strings threads ;
IN: io.servers
TUPLE: threaded-server < identity-tuple
<PRIVATE
: add-running-server ( threaded-server running-servers -- )
- 2dup in? [ server-already-running ] [ adjoin ] if ;
+ dupd ?adjoin [ drop ] [ server-already-running ] if ;
: remove-running-server ( threaded-server running-servers -- )
- 2dup in? [ delete ] [ drop server-not-running ] if ;
+ dupd ?delete [ drop ] [ server-not-running ] if ;
PRIVATE>
'[
[ _ threaded-server _ with-variable ]
[ _ stop-server ]
- [ ] cleanup
+ finally
] call ; inline
<PRIVATE