Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

with-sockets macro

  • Loading branch information...
commit 945e30084c680277f3e3240050e08ed1480936e0 1 parent 3e23d1d
@wagerlabs wagerlabs authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 zeromq-api.lisp
View
9 zeromq-api.lisp
@@ -104,6 +104,15 @@
(progn ,@body)
(zmq_close ,socket))))
+(defmacro with-sockets (sockets &body body)
+ (loop for (socket context type) in sockets
+ collect `(,socket (zmq_socket ,context ,(lookup-constant type))) into bindings
+ collect `(zmq_close ,socket) into cleanup
+ finally (return `(let ,bindings
+ (unwind-protect
+ (progn ,@body)
+ (progn ,@cleanup))))))
+
(defun send (s msg &optional flags)
(%send s (msg-raw msg) (or flags 0)))
Please sign in to comment.
Something went wrong with that request. Please try again.