[zeromq-dev] cl-zmq + sbcl threads

Vitaly Mayatskikh v.mayatskih at gmail.com
Fri Jun 25 10:50:07 CEST 2010


At Thu, 24 Jun 2010 18:14:09 +0000, Sölvi Páll Ásgeirsson wrote:
 
> Hi zeromq-dev,
> 
> I might be barking up the wrong tree, please correct me if I am.
> 
> I'm trying to get the CL bindings for ZeroMQ to play nice with SBCL
> threads, when running the following snippet:
> ------------
> (zmq:with-context (ctx 1)
>   (defun start-server ()
>     (zmq:with-socket (s ctx zmq:rep)
>       (zmq:bind s "tcp://127.0.0.1:5555")
>       (let ((message (make-instance 'zmq:msg)))
>         (zmq:recv s message)
>         (format t "~s~%" (zmq:msg-data-as-string message)))))
> 
>   (defun start-client ()
>     (zmq:with-socket (s ctx zmq:req)
>       (zmq:connect s "tcp://127.0.0.1:5555")
>       (let ((message (make-instance 'zmq:msg :data "Hello there!")))
>         (zmq:send s message)))))

It this point context is already ripped out. All macros with-foo have
lexical scoping. If you do macroexpand for with-context, you
understand it in a moment ;)

> (defvar *server* (sb-thread:make-thread #'start-server))
> (start-client)
> ------------

-- 
wbr, Vitaly



More information about the zeromq-dev mailing list