9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Alef Guarded Block
@ 1998-02-19 14:39 elliott
  0 siblings, 0 replies; 2+ messages in thread
From: elliott @ 1998-02-19 14:39 UTC (permalink / raw)


Kenji Arisawa wrote:
> Am I misunderstanding the guarded block of Alef?

I think the idea is that each individual guarded block can only have one
thread of execution in it at a time, not that only one of all the
guarded blocks in a program can have a thread of execution.

-- 
http://users.ch.genedata.com/~enh/




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [9fans] Alef Guarded Block
@ 1998-02-19 14:36 Kenji
  0 siblings, 0 replies; 2+ messages in thread
From: Kenji @ 1998-02-19 14:36 UTC (permalink / raw)


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@aichi-u.ac.jp




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-02-19 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-19 14:39 [9fans] Alef Guarded Block elliott
  -- strict thread matches above, loose matches on Subject: below --
1998-02-19 14:36 Kenji

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).