From: "Alejandro R. Mosteo" <alejandro@mosteo.com>
Subject: Re: Launching background job from Ada.Real_Time.Timing_Events
Date: Thu, 2 Jun 2016 23:22:14 +0200
Date: 2016-06-02T23:22:14+02:00 [thread overview]
Message-ID: <niq81j$r7g$1@dont-email.me> (raw)
In-Reply-To: <ni2p96$45d$1@dont-email.me>
On 25/05/16 01:52, Jeffrey R. Carter wrote:
> On 05/24/2016 07:22 AM, Alejandro R. Mosteo wrote:
>>
>> My idea was to queue the job when the event is triggered, and to have
>> a worker
>> thread waiting for jobs in the queue. However, I've just realized that
>> the event
>> handler is itself a protected action, so I can't call another potentially
>> blocking enqueue from there.
>
> I can see how this would work, with the queue in the same PO as the
> handler as Lorenzen suggested, but it seems messy to me. You need to
> store the Timing_Events somewhere until they're handled, and since
> they're limited that will require using access types. That in turn
> requires doing memory management, and that will probably need another
> task to periodically look at all the events and free those that have
> been handled. This has lots of opportunities for error.
> A simpler approach would be to package up a Time and your job info in a
> record you can put on a priority queue in Time order, and have the
> worker task do a delay until the Time. The only problem with this is
> that you need to have enough tasks to ensure all jobs are started at the
> appropriate time, or a willingness to create a new task if an event is
> queued when there are no workers available. I have used the latter
> approach and it works fine if dynamically created tasks are acceptable.
I'm in no need for strict real time requirements so I can do with this
softer approach. Thanks for the suggestion.
next prev parent reply other threads:[~2016-06-02 21:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-24 14:22 Launching background job from Ada.Real_Time.Timing_Events Alejandro R. Mosteo
2016-05-24 14:39 ` Mark Lorenzen
2016-05-24 15:06 ` Alejandro R. Mosteo
2016-05-24 22:21 ` Jeffrey R. Carter
2016-06-02 21:13 ` Alejandro R. Mosteo
2016-06-02 23:16 ` Jeffrey R. Carter
2016-05-24 23:52 ` Jeffrey R. Carter
2016-06-02 21:22 ` Alejandro R. Mosteo [this message]
2016-05-25 7:23 ` Dmitry A. Kazakov
2016-06-02 21:25 ` Alejandro R. Mosteo
2016-06-03 7:26 ` Dmitry A. Kazakov
2016-06-03 10:03 ` Alejandro R. Mosteo
2016-06-03 12:15 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox