From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Task question
Date: Mon, 10 Dec 2007 18:40:42 -0500
Date: 2007-12-10T18:40:42-05:00 [thread overview]
Message-ID: <wcctzmqm83p.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 31235206-1025-467c-8444-07a8eacc9b48@e6g2000prf.googlegroups.com
shaunpatterson@gmail.com writes:
> 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?
The task can call the function (or more likely, procedure).
Here's one way:
task type Call_Procedure (Action : not null access procedure);
(Or use whatever profile you want.)
task body Call_Procedure is
begin
Action.all;
end Call_Procedure;
Do you want Test to return while the procedure is still going?
If no, declare a local object of type Call_Procedure in Test
-- then Test will wait for the task to terminate before
returning. If yes, declare an access-to-Call_Procedure
type outside Test, and allocate an object inside Test using "new".
- Bob
next prev parent reply other threads:[~2007-12-10 23:40 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-10 22:12 Task question 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 [this message]
2007-12-11 0:43 ` anon
-- strict thread matches above, loose matches on Subject: below --
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
1997-10-06 0:00 Larry Coon
1997-10-07 0:00 ` Robert A Duff
1997-10-13 0:00 ` Larry Coon
1997-10-07 0:00 ` Matthew Heaney
1997-10-07 0:00 ` Larry Coon
1997-10-07 0:00 ` David C. Hoos, Sr.
1997-10-07 0:00 ` Steve O'Neill
1997-10-07 0:00 ` Larry Coon
1997-10-08 0:00 ` Tom Moran
1997-10-08 0:00 ` Matthew Heaney
1997-10-30 0:00 ` Balmacara9
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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox