[Openmcl-devel] Improving bordeaux-threads on CCL

James M. Lawrence llmjjmll at gmail.com
Tue Sep 10 16:05:13 PDT 2013


> Since UNWIND-PROTECT cleanup forms are effectively run with
> interrupts disabled in CCL by default,

Thanks, I wasn't aware that unwind-protect had that behavior. CCL
appears to be the only implementation that does this.

>> Interrupting threads is generally bad news because Lisp code is not
>> generally expected to be interrupt-safe.
>
> Huh.  I'd generally say that that's more true of C code than Lisp code,
> but I'd also find it hard to make sweeping generalizations like that.
>
> Perhaps different people have different general expectations.

The kind of acquire-then-release/do-then-undo pattern in the original
condition-wait is pretty common, and such code is unsafe. One reason I
asked about ccl:wait-on-semaphore was

(defun %wait-on-semaphore-ptr (s seconds milliseconds &optional flag)
  (if flag
    (if (istruct-typep flag 'semaphore-notification)
      (setf (semaphore-notification.status flag) nil)
      (report-bad-arg flag 'semaphore-notification)))
  (without-interrupts
    ...))

A thread could be terminated after setf but before without-interrupts.
That may not matter in this case, but it's the sort of thing that
prompts me to ask about interrupt-safety.



More information about the Openmcl-devel mailing list