background image
Bionic Buffalo Tech Note #105: Thread-Safe and Thread-Unsafe Procedure List
Bionic Buffalo Tech Note #105
Thread-Safe and Thread-Unsafe Procedure List
last revised Monday 2003.07.21
©2003 Bionic Buffalo Corporation. All Rights Reserved.
Tatanka and TOAD are trademarks of Bionic Buffalo Corporation
This is a list of common library routines, categorized as to whether they are assumed to be thread-safe
or thread-unsafe. This list is taken from various sources, and is not authoritative. The assumption may
be correct or incorrect in various environments, especially in non-compliant systems.
The routines listed here include procedures from POSIX, X/OPEN, GNU, and other libraries. Not all
routines may be available on all platforms.
Generally, POSIX routines not listed here (such as 
, and so on) may be
assumed to be thread-safe.
The table has two columns. When two different routines are listed on the same row, the left column is
a non-reentrant procedure, and the right column is its reentrant equivalent. The prototypes for reentrant
and non-reentrant versions of the same procedure are usually different. Often, there is no known
equivalent in any environment for a given unsafe procedure. When a function has two versions, the
performance of the unsafe version sometimes is better.
In two cases (
), the same procedure is reentrant with a non-
argument, and not thread-safe if the argument is 
Three special cases are the file locking procedures 
, and
. Although the standard locking functions (such as 
) are also thread-safe,
the behaviour of the three procedures listed here is different. The standard procedures (such as
) lock a file against access by other processes, but not against access by different threads in
the same process. The procedures 
, and 
lock a file against access by all other threads and processes, including access by different threads of the
same procedure.
Page 1 of 5