In linux using pthreads
When I call a whatever usual function (like div() sin() exp() pow() rand() nanosleep() etc.) in the following way:
thread 1
a=div(b,c).rem
thread 2
x=div(y,z).rem
so I call the same function on different (not shared) data
Can I be sure that the two function calls by the two threads do not share any (internal) data (may be registers or global-library-shared) and so have no side unpredicted effect??
pthread safe library functions?
Started by mynickmynick, May 05 2008 07:01 AM
3 replies to this topic
#1
Posted 05 May 2008 - 07:01 AM
|
|
|
#2
Posted 05 May 2008 - 11:09 AM
Threads have a different register and stack context by definition. As long as you aren't sharing any memory it should be fine.
#3
Posted 05 May 2008 - 11:59 PM
ok thanks but can I be sure that these "standard-or-usual external libraries functions" when called by different threads do not share global variables (non stack variables) on their own ??
#4
Posted 06 May 2008 - 12:09 AM
Not without viewing the source code but It's unlikely.


Sign In
Create Account


Back to top









