9fans archive / 1998 / 02 / 38 / prev next
From: Kenji Arisawa arisawa@ar....
Subject: [9fans] Alef Guarded Block
Date: Thu, 19 Feb 98 23:36:50 +0900
Hello 9fans!
Am I misunderstanding the guarded block of Alef?
The program a.l bellow lead to dead lock.
term% 8.out
alice: entering guarded block
alice: waiting msg
carol: entering guarded block
--- dead lock here ! ---
Is this correct result?
----------------------- a.l -------------------------
#include <alef.h>
void alice(chan(int) msg){
sleep(100);
print("alice: entering guarded block\n");
!{
print("alice: waiting msg\n");
<- msg;
}
print("alice: done\n");
}
void carol(chan(int) msg){
sleep(130);
print("carol: entering guarded block\n");
!{
print("carol: sending msg\n");
msg <- = 1;
}
print("carol: done\n");
}
void main(void){
chan(int) msg;
alloc msg;
par { alice(msg); carol(msg); }
}
-----------------------------------------------------
Kenji Arisawa
E-mail: arisawa@aic...