Unix Threads Question:

When should we use thread-safe "_r" library calls?

Tweet Share WhatsApp

Answer:

If your system provides threads, it will probably provide a
set of thread-safe variants of standard C library routines.
A small number of these are mandated by the POSIX standard,
and many Unix vendors provide their own useful supersets,
including functions such as gethostbyname_r().
Unfortunately, the supersets that different vendors support
do not necessarily overlap, so you can only safely use the
standard POSIX-mandated functions. The thread-safe routines
are conceptually "cleaner" than their stateful
counterparts, though, so it is good practice to use them
wherever and whenever you can.

Download Unix Threads PDF Read All 12 Unix Threads Questions
Previous QuestionNext Question
How to work UNIX commands on Windows XP without installing UNIX O/S in PC?What are the Performance differences between User-space threads and Kernel-supported threads.?