[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] difference between ##sys#error and posix-error?

From: Jörg F . Wittenberger
Subject: Re: [Chicken-users] difference between ##sys#error and posix-error?
Date: 29 Sep 2011 13:41:43 +0200

On Sep 29 2011, Alaric Snell-Pym wrote:

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.

The core units are compiled without interrupt checking.

There is no chicken thread switch coming in here.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]