D
dm
Hi,
I'd like to know if the C standard can guarantee that an assignment to/from
a variable will be atomic, that is will occur in a single indivisible
instruction.
For example, if I have the following code:
int global_var;
void set_global_var(int var) {
global_var = var;
}
int get_global_var(void) {
return global_var;
}
If two threads can call get_global_var and set_global_var, do I have to use
a semaphore ?
Thanks for your help.
I'd like to know if the C standard can guarantee that an assignment to/from
a variable will be atomic, that is will occur in a single indivisible
instruction.
For example, if I have the following code:
int global_var;
void set_global_var(int var) {
global_var = var;
}
int get_global_var(void) {
return global_var;
}
If two threads can call get_global_var and set_global_var, do I have to use
a semaphore ?
Thanks for your help.