<div><br></div><div>clozure cl haven't implements condition-variable. so..</div><div><br></div><div>(defun bt:make-condition-variable ()</div><div> (ccl:make-semaphore))</div><div><br></div><div><br></div><div>but, condition-variable and semaphore are different. right?</div>
<div>It can cause problems, I think.</div><div>Perhaps, It's make meaningless loop.</div><div><br></div><div>I just wonder why something like this that you have not implemented in bordeaux-threads</div><div><br></div>
<div><br></div><div>(in-package #:bordeaux-threads)</div><div><br></div><div>(defclass condition-variable ()</div><div> ((sem-count :initform 0 :accessor sem-count)</div><div> (semaphore :initform (ccl:make-semaphore) :reader semaphore)))</div>
<div><br></div><div><br></div><div>(defun make-condition-variable ()</div><div> (make-instance 'condition-variable))</div><div><br></div><div><br></div><div>(defun condition-wait (condition-variable lock)</div><div> (unwind-protect (progn (incf (sem-count condition-variable))</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> (release-lock lock)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> (ccl:wait-on-semaphore (semaphore condition-variable)))</div>
<div> (acquire-lock lock)))</div><div><br></div><div><br></div><div>(defun condition-notify (condition-variable)</div><div> (when (> (sem-count condition-variable) 0)</div><div> (decf (sem-count condition-variable))</div>
<div> (ccl:signal-semaphore (semaphore condition-variable))))</div><div><br></div><div><br></div><div><br></div><div>I don't know about it....</div><div><br></div><div><br></div>