Thread-safeness of API functions
Joris van Rantwijk
jorisvr at sron.nl
Fri Jul 30 15:34:17 UTC 2010
Hello,
I have a few questions about thread-safeness of the RTEMS API.
Are all functions in the C and POSIX API reentrant (except for the well
known unsafe functions such as gmtime() and strtok()). For example, is
it safe when two tasks concurrently call fprintf() for two different
file descriptors?
Is it also safe if two tasks concurrently call printf() for the *same*
file descriptor?
POSIX.1c seems to guarantee that this is safe ("man 3p flockfile").
In the source code of newlib, I see that indeed vfprintf() internally
calls flockfile(). However flockfile() itself is not implemented either
in newlib or in RTEMS. So it seems that concurrent calls to printf() for
the same file descriptor are dangerous and could potentially crash the
application. Is that true?
I have the same questions about sockets. For example, is it safe to
concurrently call connect() for different sockets?
Is it safe to concurrently call sendmsg() for the same socket?
Please help me out. I can not find this in the documentation.
Greetings,
Joris.
More information about the users
mailing list