Alaric Snell-Pym scripsit: > 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 problem is actually worse than that: a call to a C library earlier in the program might have spawned[*] an OS thread that has itself called strerror, corrupting the internal buffer. Any program that allows the user to invoke arbitrary libraries must assume that it is running more than one OS thread. [*] I say "spawned" because OS threads are denizens of the uttermost depths of Hell. > The solution, if that is a potential problem, is strerror_r, where you > pass in your own string buffer. That is what must be done. -- Babies are born as a result of the John Cowan mating between men and women, and most http://www.ccil.org/~cowan men and women enjoy mating. [email protected] --Isaac Asimov in Earth: Our Crowded Spaceship _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
