a thread-safe function is just that.. thread-safe. e.g. you can use it in
a multithread environment (e.g. gcc -D_PTHREAD)

e.g. some functions e.g. strtok use an internal data area to return
data. this function is NOT thread-safe because if two threads in a single
program call strtok, the function will get confused. that's why  there
exists strtok_r.

solaris has a nice man page which lists all the thread-safe functions, its
more definitive than the glibc man pages.

however in general if a function ends with _r its thread safe.

as for linux not supporting threads.. thats a matter of semantics. threads
traditionally cost much less than processes to create, so theyre
"better". but on linux the cost of creating a process is much less than on
other os's (creating a proc on linux via clone is even faster than
creating an LWP on solaris) so it doesnt matter if threads are
"emulated" via processes.


-- 

---------------------------------------------------------------------
Orlando Andico <[EMAIL PROTECTED]>       POTS Phone: +63   (2) 937-2293
Mosaic Communications, Inc.            GSM Mobile: +63 (917) 531-5893
I'm not suffering from insanity -- I'm enjoying  every minute of it!!


_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Reply via email to