9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Kenji Arisawa arisawa@ar.aichi-u.ac.jp
Subject: [9fans] Alef Guarded Block
Date: Thu, 19 Feb 1998 23:36:50 +0900	[thread overview]
Message-ID: <19980219143650.k6-3J8fJSTuXBNWYO5QACmmTxDgQyMtwKwo_6fcr2a8@z> (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




             reply	other threads:[~1998-02-19 14:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-19 14:36 Kenji [this message]
1998-02-19 14:39 elliott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19980219143650.k6-3J8fJSTuXBNWYO5QACmmTxDgQyMtwKwo_6fcr2a8@z \
    --to=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).