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

Answers were Sorted based on User's Feedback



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

Answer / guest

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.

Is This Answer Correct ?    4 Yes 0 No

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

Answer / vidya

If you compile using _REENTRANT option, the thread-safe
functions are automatically substituted for the non thread
safe function. You need not specify *_r, you only use *

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Unix Threads Interview Questions

how to edit the network interface device type in container(zone) in solaris 10?

2 Answers   TCS,


Explain what is critical section?

0 Answers  


How to work unix commands on windows xp without installing unix o/s in pc?

0 Answers  


What is Critical section?

13 Answers   TCS,


Tell me when should we use thread-safe "_r" library calls?

0 Answers  






List the system calls used for process management?

0 Answers  


what is Context switch?

6 Answers  


How would you kill a process?

0 Answers  


Explain similarities between thread and process?

0 Answers  


tell me similarities between thread and process

4 Answers   Tanla Solutions,


What is protection boundary?

0 Answers  


Explain what are threads?

0 Answers  


Categories