comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: global rendezvou's
Date: 1999/06/05
Date: 1999-06-05T00:00:00+00:00	[thread overview]
Message-ID: <m3k8tj9woy.fsf@mheaney.ni.net> (raw)
In-Reply-To: 7hl0uh$omg$1@nnrp1.deja.com

kumkwat@my-dejanews.com writes:

> I was wondering if it was possible to have a entry call in a task that
> was not only defined in multiple tasks but because it is then I
> wouldn't have to specify the name of the task first before calling the
> entry.  Basically I don't want to call the entry on a specific task but
> just tell everyone that I want to pass an object to the first thread
> that calls an accept.  I've got a way via a protected object as a
> buffer but was wondering if I could circumvent that and just do it this
> way.

If you want a broadcast feature, then you need to use a protected object
to implement a signal.

There are many examples of this in the ACM patterns archive; see the
dining philosophers series of articles.

<http://www.acm.org/archives/patterns.html>

 
> task temp1 is
>    entry hello;
> end temp1;
> 
> task temp2 is
>    entry hello;
> end temp2;
> 
> 
> -- somewhere in the main thread
> hello;
> 
> -- and not temp1.hello; or temp2.hello;


You sound like you know this, but here it goes:

  protected Task_Initialization is

    procedure Start;

    entry Wait;

  private

    Started : Boolean := False;

  end;

  protected body Task_Initialization is

    procedure Start is
    begin
      Started := True;
    end;

    entry Wait when Started is
    begin
      null;
    end;

  end;


  task body Temp1 is
  begin

    Task_Initialization.Wait;

    ...

  end;


  task body Temp2 is
  begin

    Task_Initialization.Wait;

    ...

  end;
 




  reply	other threads:[~1999-06-05  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-15  0:00 global rendezvou's kumkwat
1999-06-05  0:00 ` Matthew Heaney [this message]
1999-06-05  0:00   ` Nick Roberts
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox