comp.lang.ada
 help / color / mirror / Atom feed
* Task question
@ 1997-10-06  0:00 Larry Coon
  1997-10-07  0:00 ` David C. Hoos, Sr.
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Larry Coon @ 1997-10-06  0:00 UTC (permalink / raw)



I'm having a problem getting a task body to work
the way I want it to.  Here's a contrived example
showing (with illegal syntax) what I want to do:

task body x is
begin
   loop
      select
         accept my_rendezvous (some_data: some_data_type) do
            -- Rendezvous stuff
         end my_rendezvous;
      or
         exit;  -- This is illegal
      end select;
   end loop;
   -- Now do more stuff.
end x;

The idea is that this task serves as a collector.
Another task continually initiates rendezvous (what
is plural for rendezvous?), with this task, and this
tasks collects the information that is sent.  When the
"calling" task is done it terminates.  Since the select
statement is smart, it knows it can't be called any
more and invokes the exit, which terminates the loop
so the rest of the task body executes, and it does
more stuff.  That's how I want it to work, anyway.

If I do:

   or
      terminate;

in place of the exit then it knows when the "calling"
task is done and will terminate the task, but this isn't
what I want -- the "other stuff" never gets executed.

I've also tried adding another accept as a signal for
when the "calling" task is done:

task body x is
begin
   loop
      select
         accept my_rendezvous (some_data: some_data_type) do
            -- Rendezvous stuff
         end my_rendezvous;
      or
         accept done do
            exit;
         end done;
      end select;
   end loop;
   -- Now do more stuff.
end x;

Now the "calling" task keeps initiating a my_rendezvous,
but when it's finished it inititates a done to let this
task know it can proceed.  This doesn't work either -- it
doesn't let an exit transfer control out of the accept
statement.

Am I missing an obvious way to do what I want?

Larry Coon
University of California
larry@fs2.assist.uci.edu
and lmcoom@home.com




^ permalink raw reply	[flat|nested] 24+ messages in thread
* Task question
@ 2007-12-10 22:12 shaunpatterson
  2007-12-10 22:29 ` gpriv
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: shaunpatterson @ 2007-12-10 22:12 UTC (permalink / raw)


Hey,

   What is the best / proper way to spawn a new task so that a
function call can
continue in the background.. like so:

procedure Test is
  begin

          -- Call a callback function that may take a long time
          FuncPtr.all


          -- Continue other processing here

  end Test;


Is there any way to encapsulate the callback function call in another
task WITHOUT making
the function -- the function called by funcptr.all -- a new task?

Thanks

--
Shaun



^ permalink raw reply	[flat|nested] 24+ messages in thread
* Task question...
@ 1997-10-16  0:00 Paul Van Gorp
  1997-10-19  0:00 ` elaine.waybright
  1997-10-21  0:00 ` Robert A Duff
  0 siblings, 2 replies; 24+ messages in thread
From: Paul Van Gorp @ 1997-10-16  0:00 UTC (permalink / raw)



Hi, I have this strange problem when using tasking in Ada95

compiler: GNAT 3.10p1
OS: micro$oft w95.

Im looking for a way to accomplish the following (im sure there exists a
simple soln!)

task type t1 is
	entry reply;
	...
end t1;

task type t2 is
	...
end t2;

task body t1 is
	T: t2;
begin
	loop
		select
			accept reply;
			T.do_something;
			...
		or
			...
			T.do_something_else;
			...
		end select;
	end loop;
end t1;

task body t2 is
begin
	loop
		select
			...
			-- what I want here, is to invoke t1.reply
			-- from within different instances of T1
			-- if you know what I mean
		end select;
	end loop;
end t2;

so, if I went something like...

taska, taskb: t1;

each taska and taskb would have its own instance of T, which they
could rendezvous with easily enough with T.whatever, but how could that
task T rendezvous with the task that called it ?

Thanks in advance..

Paul

	...




^ permalink raw reply	[flat|nested] 24+ messages in thread
* task question
@ 1996-09-15  0:00 Nicolay Belofastow
  1996-09-23  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 24+ messages in thread
From: Nicolay Belofastow @ 1996-09-15  0:00 UTC (permalink / raw)



Hello,

I am novice in ADA, and  have a question concerning operator
ACCEPT:

normal usage would be somewhere in the task body:

accept Entry( Par1 : integer) do 
  -- some actions here;
end Entry;

my program with accept, compiled by GNAT 3.04 shows, that body of
the accept (commented as "some actions") looks like protected 
section -- before "some action " is not finished, no other task 
gets control. The question is -- is this standard feature of the
ADA, or it is only belongs to GNAT or Windows 95?

Thanks in advance, Nick.

--
-------------------------------------------------
Nickolay Belofastow
University of the Federal Armed Forces, Munich
e81bnick@rz.unibw-muenchen.de




^ permalink raw reply	[flat|nested] 24+ messages in thread
[parent not found: <204266@QZCOM>]

end of thread, other threads:[~2007-12-11  0:43 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-06  0:00 Task question Larry Coon
1997-10-07  0:00 ` David C. Hoos, Sr.
1997-10-07  0:00   ` Larry Coon
1997-10-07  0:00   ` Steve O'Neill
1997-10-08  0:00   ` Matthew Heaney
1997-10-08  0:00   ` Tom Moran
1997-10-07  0:00 ` Matthew Heaney
1997-10-07  0:00   ` Larry Coon
1997-10-07  0:00 ` Robert A Duff
1997-10-13  0:00   ` Larry Coon
1997-10-30  0:00 ` Balmacara9
  -- strict thread matches above, loose matches on Subject: below --
2007-12-10 22:12 shaunpatterson
2007-12-10 22:29 ` gpriv
2007-12-10 22:51   ` shaunpatterson
2007-12-10 23:13     ` gpriv
2007-12-10 23:40 ` Robert A Duff
2007-12-11  0:43 ` anon
1997-10-16  0:00 Paul Van Gorp
1997-10-19  0:00 ` elaine.waybright
1997-11-01  0:00   ` Matthew Heaney
1997-10-21  0:00 ` Robert A Duff
1996-09-15  0:00 task question Nicolay Belofastow
1996-09-23  0:00 ` Matthew Heaney
     [not found] <204266@QZCOM>
1986-09-26 17:28 ` Task question Matts_Kallioniemi_QZ

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