/[cmucl]/src/code/remote.lisp
ViewVC logotype

Diff of /src/code/remote.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by emarsden, Sun Jul 20 13:49:43 2003 UTC revision 1.9.50.1 by rtoy, Thu Feb 25 20:34:51 2010 UTC
# Line 16  Line 16 
16  ;;;  ;;;
17    
18  (in-package "WIRE")  (in-package "WIRE")
19    (intl:textdomain "cmucl")
20    
21  (export '(remote remote-value remote-value-bind create-request-server  (export '(remote remote-value remote-value-bind create-request-server
22            destroy-request-server connect-to-remote-server))            destroy-request-server connect-to-remote-server))
# Line 27  Line 28 
28    finished)    finished)
29    
30  (defvar *pending-returns* nil  (defvar *pending-returns* nil
31    "AList of wire . remote-wait structs")    _N"AList of wire . remote-wait structs")
32    
33    
34  ;;; MAYBE-NUKE-REMOTE-WAIT -- internal  ;;; MAYBE-NUKE-REMOTE-WAIT -- internal
# Line 51  Line 52 
52  ;;; environment of the macro call. No values are returned.  ;;; environment of the macro call. No values are returned.
53  ;;;  ;;;
54  (defmacro remote (wire-form &body forms)  (defmacro remote (wire-form &body forms)
55    "Evaluates the given forms remotly. No values are returned, as the remote    _N"Evaluates the given forms remotly. No values are returned, as the remote
56  evaluation is asyncronus."  evaluation is asyncronus."
57    (let ((wire (gensym)))    (let ((wire (gensym)))
58      `(let ((,wire ,wire-form))      `(let ((,wire ,wire-form))
# Line 71  evaluation is asyncronus." Line 72  evaluation is asyncronus."
72  ;;; return, cause we can kind of guess at what the currect results would be.  ;;; return, cause we can kind of guess at what the currect results would be.
73  ;;;  ;;;
74  (defmacro remote-value-bind (wire-form vars form &rest body)  (defmacro remote-value-bind (wire-form vars form &rest body)
75    "Bind VARS to the multiple values of FORM (which is executed remotely). The    _N"Bind VARS to the multiple values of FORM (which is executed remotely). The
76  forms in BODY are only executed if the remote function returned (as apposed  forms in BODY are only executed if the remote function returned (as apposed
77  to aborting due to a throw)."  to aborting due to a throw)."
78    (cond    (cond
# Line 141  to aborting due to a throw)." Line 142  to aborting due to a throw)."
142  ;;;  ;;;
143  (defmacro remote-value (wire-form form &optional  (defmacro remote-value (wire-form form &optional
144                                    (on-server-unwind                                    (on-server-unwind
145                                     `(error "Remote server unwound")))                                     `(error _"Remote server unwound")))
146    "Execute the single form remotly. The value of the form is returned.    _N"Execute the single form remotly. The value of the form is returned.
147    The optional form on-server-unwind is only evaluated if the server unwinds    The optional form on-server-unwind is only evaluated if the server unwinds
148    instead of returning."    instead of returning."
149    (let ((remote (gensym))    (let ((remote (gensym))
# Line 322  to aborting due to a throw)." Line 323  to aborting due to a throw)."
323  ;;; it, call NEW-CONNECTION to do the connecting.  ;;; it, call NEW-CONNECTION to do the connecting.
324  ;;;  ;;;
325  (defun create-request-server (port &optional on-connect &key reuse-address)  (defun create-request-server (port &optional on-connect &key reuse-address)
326    "Create a request server on the given port.  Whenever anyone connects to it,    _N"Create a request server on the given port.  Whenever anyone connects to it,
327     call the given function with the newly created wire and the address of the     call the given function with the newly created wire and the address of the
328     connector.  If the function returns NIL, the connection is destroyed;     connector.  If the function returns NIL, the connection is destroyed;
329     otherwise, it is accepted.  This returns a manifestation of the server that     otherwise, it is accepted.  This returns a manifestation of the server that
# Line 344  to aborting due to a throw)." Line 345  to aborting due to a throw)."
345  ;;; closes the socket behind it.  ;;; closes the socket behind it.
346  ;;;  ;;;
347  (defun destroy-request-server (server)  (defun destroy-request-server (server)
348    "Quit accepting connections to the given request server."    _N"Quit accepting connections to the given request server."
349    (system:remove-fd-handler (request-server-handler server))    (system:remove-fd-handler (request-server-handler server))
350    (ext:close-socket (request-server-socket server))    (ext:close-socket (request-server-socket server))
351    nil)    nil)
# Line 355  to aborting due to a throw)." Line 356  to aborting due to a throw)."
356  ;;; installed to handle return values, etc.  ;;; installed to handle return values, etc.
357  ;;;  ;;;
358  (defun connect-to-remote-server (hostname port &optional on-death)  (defun connect-to-remote-server (hostname port &optional on-death)
359    "Connect to a remote request server addressed with the given host and port    _N"Connect to a remote request server addressed with the given host and port
360     pair.  This returns the created wire."     pair.  This returns the created wire."
361    (let* ((socket (ext:connect-to-inet-socket hostname port))    (let* ((socket (ext:connect-to-inet-socket hostname port))
362           (wire (make-wire socket)))           (wire (make-wire socket)))

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.9.50.1

  ViewVC Help
Powered by ViewVC 1.1.5