Last active
October 10, 2016 09:12
-
-
Save deadtrickster/5cdb8f1d761d363e2057ec770c137f1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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