-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 09/29/2011 08:36 AM, Christian Kellermann wrote:
Hi Alan!
* Alan Post <address@hidden> [110929 05:51]:
Looking at posixunix.scm, I find that some error messages are
produced with ##sys#error, and others with posix-error. What
distinguishes these two routines? Why would I use one but not
the other?
(define posix-error
(let ([strerror (foreign-lambda c-string "strerror" int)]
[string-append string-append] )
(lambda (type loc msg . args)
(let ([rn (##sys#update-errno)])
(apply ##sys#signal-hook type loc (string-append msg " - "
(strerror rn)) args) ) ) ) )
Ooof, is that correct? IIRC, strerror isn't thread safe. We may not be
using POSIX threads, but might Chicken not schedule a new thread between
strerror and string-append, which might itself call strerror and thus
produce an invalid error message? I'm not sure at what points the
scheduler is actually able to preempt.