Skip to content

Instantly share code, notes, and snippets.

@deadtrickster
Last active October 10, 2016 09:12
Show Gist options
  • Save deadtrickster/5cdb8f1d761d363e2057ec770c137f1f to your computer and use it in GitHub Desktop.
Save deadtrickster/5cdb8f1d761d363e2057ec770c137f1f to your computer and use it in GitHub Desktop.
(ql:quickload :iolib)
(ql:quickload :eventfd)
(setf control-fd (eventfd:eventfd.new 0))
(setf event-base (make-instance 'iolib:event-base))
(setf thread (bt:make-thread (lambda ()
(iolib:set-io-handler event-base
control-fd
:read (lambda (fd e ex)
(declare (ignorable fd e ex)))
(log:debug (eventfd.read control-fd))))
(loop (iolib:event-dispatch event-base :one-shot t)))))
(defun run-test ()
(eventfd:eventfd.notify-1 control-fd)
(let ((mutex (bt:make-lock))
(cond (bt:make-condition-variable)))
(bt:with-lock-held (mutex)
(loop (print (sb-thread:condition-wait cond mutex :timeout 10))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment