[Proj] libproj4 thread safety

Gerald Evenden gerald.evenden at verizon.net
Sun Apr 24 16:52:29 EDT 2005


Oops!  Found another little thread problem.  pj_strerrno.c calls the 
libc
routine strerror for positive error numbers and it is not thread-safe.
Linux info suggests strerror_r which is thread-safe.  This may only be a
Linux procedure and pose a transportability problem.

For negative arguments, pj_strerrno returns pointer to const strings
so that aspect should be thread-safe although I should tighten up the
prototyping.

But to accommodate strerror pj_strerrno will have to look like:

int pj_strerrno(int err, char * buff, int length);

where err is the errno code, buff is a 'length' long and the procedure
returns 1 on an invalid errno and 0 for successful call.

Oh, bother.

Found this while rewriting the manual page on errors and while reading
H&S I detected funky description of what strerror was doing and 
resorted to
checking info which gave the bad news.  At the moment I do not 
understand
why strerror just doesn't return a pointer to a const string.  Fie!
_____________________________________
Jerry and the low riders: Daisy Mae and Joshua.
"The whole religious complexion of the modern world is due to the
absence from Jerusalem of a lunatic asylum." Havelock Ellis, 1914




More information about the Proj mailing list