comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Termination of tasks waiting on a protected queue
Date: Sun, 18 May 2014 10:16:48 -0700
Date: 2014-05-18T10:16:48-07:00	[thread overview]
Message-ID: <llapu0$ntf$2@dont-email.me> (raw)
In-Reply-To: <slrnlngofv.i0l.lithiumcat@nat.rebma.instinctive.eu>

On 05/18/2014 12:32 AM, Natasha Kerensikova wrote:
>
> I have been having a task termination issue, and I'm wondering whether I
> got my design wrong or whether I'm missing something, so I ask you to
> help me on that.
>
> The basic need is delegating potentially long jobs to a dedicated task
> (or pool of tasks) so that the program flow generating the jobs and
> continue quickly. I furthermore assume that the jobs are "fire and
> forget", that there is no need to report anything about completion (or
> lack of thereof) to the code that generated the jobs (or more
> realistically, that reporting is performed through channels outside of
> the scope of the problem).

I have done something similar for pools of worker tasks. I used an instance of 
PragmARC.Queue_Unbounded_Blocking to hold the job requests rather than rolling 
my own for each task pool. The solution to termination was to use a timed entry 
call to the queue, with another protected object with a function to indicate if 
the pool tasks should end. The tasks looked like

Forever : loop
    select
       Job_Queue.Get (Item => Info);

       Process (Info => Info);
    or
       delay Check_Interval;

       exit Forever when Control.Finalizing;
    end select;
end loop Forever;

Obviously not Ravenscar compliant.

Check_Interval was quite long, 2 seconds.

-- 
Jeff Carter
"If I could find a sheriff who so offends the citizens of Rock
Ridge that his very appearance would drive them out of town ...
but where would I find such a man? Why am I asking you?"
Blazing Saddles
37

  parent reply	other threads:[~2014-05-18 17:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-18  7:32 Termination of tasks waiting on a protected queue Natasha Kerensikova
2014-05-18  9:24 ` anon
2014-05-18 19:43   ` Natasha Kerensikova
2014-05-18 17:16 ` Jeffrey Carter [this message]
2014-05-18 19:54   ` Natasha Kerensikova
2014-05-18 21:54     ` Jeffrey Carter
2014-05-18 18:42 ` sbelmont700
2014-05-18 18:48   ` Jeffrey Carter
2014-05-18 20:51     ` sbelmont700
2014-05-18 21:44       ` Jeffrey Carter
2014-05-19 21:49   ` Randy Brukardt
2014-05-20  7:54     ` Dmitry A. Kazakov
2014-05-20  7:58       ` Dmitry A. Kazakov
2014-05-18 23:05 ` Brad Moore
2014-05-19  7:28   ` Natasha Kerensikova
2014-05-27 11:08   ` Alejandro R. Mosteo
2014-05-28  1:04     ` Brad Moore
replies disabled

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