any function for entering critical section?
hi
my question is:
if there are many vars shared between threads for condition checking
such as
if(shared_var1 > 0)
{...}
because other thread may do this at the same time
how to guarantee that threads exclusively access the var
i feel a bit troublesome to define respective mutex for every shared var that may be access by more than one thread. so, is there any function can do this.
in uCos, the OS_ENTER_CRITICAL function does this well
in Linux, is there any similar functions?
|