What happens if two pthreads are calling the msgsnd() function at the "same" time, posting message to the same message queue ?
What if two processes do the same ? Does it matter if they are threads or processes ?
Specifically interested for Linux 2.6.15-2.5 #1 SMP PREEMPT Tue Sep 19 10:56:25 CDT 2006 x86_64 x86_64 x86_64 GNU/Linux
The man page for pthreads tells you what you want to know:
A thread-safe function is one that can be safely (i.e., it will deliver the same results regardless of whether it is) called from multiple threads at the same time.
POSIX.1-2001 and POSIX.1-2008 require that all functions specified in the standard shall be thread-safe...
msgsnd
is among the functions defined by POSIX, and is not excluded from this requirement. It doesn't matter if it is two threads or two processes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With