Hi Alain, On Fri, 27 Jul 2007 16:02:04 +1000, Alain Picard <Alain.Picard@memetrics.com> wrote:
I'm wondering if cl-gd has been thoroughly tested for thread safety?
No, not really. I've sometimes used it in multi-threaded environments (without any issues), but I wouldn't count that as serious tests.
Cursory inspection of the code seems to suggest, for instance, that *transfomers* is not safe; the only references to this variable I see are in specials.lisp: (defvar *transformers* nil "Stack of currently active transformer objects.")
and in WITH-TRANFORMATION, which does not create a new binding for *transformers*, but rather just pushes a new transformation onto the global *transformers*.
Am I reading this right? It seems to me that two different lispworks threads could run in such a way so that 1 thread inadvertently starts running with transformers that another thread establishes then gets swapped out.
Right. It would certainly be better to rebind *TRANSFORMERS* here. I'll fix this. But this shouldn't be the reason for segfaults, should it? I'm wondering if libgd itself is thread-safe. From http://www.libgd.org/Main_Page it doesn't necessarily look as if it is. Cheers, Edi.