From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Alejandro R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: Launching background job from Ada.Real_Time.Timing_Events Date: Tue, 24 May 2016 17:06:27 +0200 Organization: A noiseless patient Spider Message-ID: References: <5557a3ec-c208-48fe-bdd5-f20ca36b7653@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 24 May 2016 15:02:49 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="df6c13c4617621ca1de5ec657b563bf1"; logging-data="13393"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19IQoTI4Dd1DgDKMyFG4hzw" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 In-Reply-To: <5557a3ec-c208-48fe-bdd5-f20ca36b7653@googlegroups.com> Cancel-Lock: sha1:d/6vrtSzlovY3E4CUBiEvd/o7dU= Xref: news.eternal-september.org comp.lang.ada:30474 Date: 2016-05-24T17:06:27+02:00 List-Id: On 24/05/16 16:39, Mark Lorenzen wrote: > On Tuesday, May 24, 2016 at 4:22:36 PM UTC+2, Alejandro R. Mosteo wrote: >> Hello all, >> >> I'm stuck with something not that strange, so I guess I need another >> viewpoint on it. >> >> I want to trigger, in the future, a possibly long computation in the >> background. For that I had thought of using the built-in Real_Time events. >> >> 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. >> >> Any ideas? Basically, how to trigger another task (without creating it) >> from within a protected handler? >> >> Thanks, >> Alex. > > You can let the PO implementing the job queue be the same as the PO implementing the timing event handler. > > If you want to detach the high-priority PO implementing the timer event handler from the PO implementing the job queue, then let a task block on an entry in the first PO and put the job into the second PO. The task is then the active object moving data between the POs and thus detaching them. Thank you! I don't know what I was thinking... > > Regards, > > Mark L