How to ensure atomic execution of lines# Unix - 噫吁兮,危乎高哉
z*g
1 楼
Consider this case,
....;
....;
p(semaphore);//Entering waiting state
How can I make sure the last line is executed immediately after preceding
lines?
Sometimes, OS will preempt the program just before the p(..) is executed and
resume the program later. This may cause bad race condition.
I appreciate any clues for solving this problem. Thanks a lot.
....;
....;
p(semaphore);//Entering waiting state
How can I make sure the last line is executed immediately after preceding
lines?
Sometimes, OS will preempt the program just before the p(..) is executed and
resume the program later. This may cause bad race condition.
I appreciate any clues for solving this problem. Thanks a lot.