Move distributed concurrency specific stuff from messaging to distributed
parent
6b7d723982
commit
72ae46e72b
|
@ -1,11 +1,27 @@
|
||||||
! Copyright (C) 2005 Chris Double. All Rights Reserved.
|
! Copyright (C) 2005 Chris Double. All Rights Reserved.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: serialize sequences concurrency.messaging threads io
|
USING: serialize sequences concurrency.messaging threads io
|
||||||
io.servers.connection io.encodings.binary
|
io.servers.connection io.encodings.binary assocs init
|
||||||
arrays namespaces kernel accessors ;
|
arrays namespaces kernel accessors ;
|
||||||
FROM: io.sockets => host-name <inet> with-client ;
|
FROM: io.sockets => host-name <inet> with-client ;
|
||||||
IN: concurrency.distributed
|
IN: concurrency.distributed
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
|
: registered-processes ( -- hash )
|
||||||
|
\ registered-processes get-global ;
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
|
: register-process ( name process -- )
|
||||||
|
swap registered-processes set-at ;
|
||||||
|
|
||||||
|
: unregister-process ( name -- )
|
||||||
|
registered-processes delete-at ;
|
||||||
|
|
||||||
|
: get-process ( name -- process )
|
||||||
|
dup registered-processes at [ ] [ thread ] ?if ;
|
||||||
|
|
||||||
SYMBOL: local-node
|
SYMBOL: local-node
|
||||||
|
|
||||||
: handle-node-client ( -- )
|
: handle-node-client ( -- )
|
||||||
|
@ -41,3 +57,9 @@ M: thread (serialize) ( obj -- )
|
||||||
|
|
||||||
: stop-node ( node -- )
|
: stop-node ( node -- )
|
||||||
f swap send-remote-message ;
|
f swap send-remote-message ;
|
||||||
|
|
||||||
|
[
|
||||||
|
H{ } clone \ registered-processes set-global
|
||||||
|
] "remote-thread-registry" add-init-hook
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
! Copyright (C) 2006 Chris Double.
|
! Copyright (C) 2006 Chris Double.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: help.syntax help.markup concurrency.messaging.private
|
USING: help.syntax help.markup
|
||||||
threads kernel arrays quotations strings ;
|
threads kernel arrays quotations strings ;
|
||||||
IN: concurrency.messaging
|
IN: concurrency.messaging
|
||||||
|
|
||||||
|
|
|
@ -68,21 +68,3 @@ M: cannot-send-synchronous-to-self summary
|
||||||
receive [
|
receive [
|
||||||
data>> swap call
|
data>> swap call
|
||||||
] keep reply-synchronous ; inline
|
] keep reply-synchronous ; inline
|
||||||
|
|
||||||
<PRIVATE
|
|
||||||
|
|
||||||
: registered-processes ( -- hash )
|
|
||||||
\ registered-processes get-global ;
|
|
||||||
|
|
||||||
PRIVATE>
|
|
||||||
|
|
||||||
: register-process ( name process -- )
|
|
||||||
swap registered-processes set-at ;
|
|
||||||
|
|
||||||
: unregister-process ( name -- )
|
|
||||||
registered-processes delete-at ;
|
|
||||||
|
|
||||||
: get-process ( name -- process )
|
|
||||||
dup registered-processes at [ ] [ thread ] ?if ;
|
|
||||||
|
|
||||||
\ registered-processes [ H{ } clone ] initialize
|
|
||||||
|
|
Loading…
Reference in New Issue