Mutual Exclusion Problem

后端 未结 6 1185
陌清茗
陌清茗 2021-01-13 16:47

Please take a look on the following pseudo-code:

boolean blocked[2];
int turn;
void P(int id) {
      while(true) {
             blocked[id] = true;
                 


        
6条回答
  •  醉酒成梦
    2021-01-13 17:34

    Is this homework, or some embedded platform? Is there any reason why you can't use pthreads or Win32 (as relevant) synchronisation primitives?

提交回复
热议问题