[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
strerror thread safety
From: |
Kevin Ryde |
Subject: |
strerror thread safety |
Date: |
Wed, 28 Jul 2004 09:02:47 +1000 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
* error.c (scm_strerror): Use scm_i_misc_mutex around strerror since
it's not thread safe.
(scm_syserror): Use scm_strerror rather than SCM_I_STRERROR, to take
advantage of this.
* fports.c (scm_open_file): Use scm_strerror likewise.
* filesys.c (scm_stat, scm_lstat): Ditto.
A program provoking the problem (in glibc at least),
(use-modules (ice-9 threads))
(define e1 9999)
(define s1 (strerror e1))
(define e2 7777)
(define s2 (strerror e2))
(begin-thread
(while #t
(display "-")
(let ((s (strerror e1)))
(if (not (string=? s1 s))
(begin
(format #t "oops, wrong s1, got ~s want ~s\n" s s1)
(primitive-exit 1))))))
(while #t
(display ".")
(let ((s (strerror e2)))
(if (not (string=? s2 s))
(begin
(format #t "oops, wrong s2, got ~s want ~s\n" s s2)
(primitive-exit 1)))))
error.c.strerror-mutex.diff
Description: Text document
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- strerror thread safety,
Kevin Ryde <=