comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Launching background job from Ada.Real_Time.Timing_Events
Date: Fri, 3 Jun 2016 09:26:48 +0200
Date: 2016-06-03T09:26:48+02:00	[thread overview]
Message-ID: <nirbgq$17j2$1@gioia.aioe.org> (raw)
In-Reply-To: niq88b$rp2$1@dont-email.me

On 02/06/2016 23:25, Alejandro R. Mosteo wrote:

> I'm sorry but I don't follow your explanation. To make things simpler,
> let's consider only the 1-to-1 case. How's this protected used without a
> blocking operation?

If you have FIFO, a lock-free implementation is a buffer with one read 
and one write index (mod buffer length). The read index never advances 
beyond the write index. Reader updates the read index and looks at the 
write index, and conversely the writer. Indices must have pragma Atomic, 
and the buffer not cached. For example:

http://www.dmitry-kazakov.de/ada/components.htm#10.1.1

Of course if you want to wait for a FIFO state, e.g. 'not full' or 'not 
empty' you will need an event (a protected object). But you don't need 
to have the FIFO a protected object.

It is an important point not to have containers protected. Operations on 
container might be quite expensive depending on the element types and 
the container structure. As a rule you should not maintain containers on 
the context of a protected action. E.g. if you have to do a binary 
search to get an element, that is not to do in a protected action.

>>> Any ideas? Basically, how to trigger another task (without creating it)
>>> from within a protected handler?

By changing an entry barrier, of course.

The task to trigger waits for a protected entry to open, it is released 
after leaving the entry.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2016-06-03  7:26 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
2016-05-25  7:23 ` Dmitry A. Kazakov
2016-06-02 21:25   ` Alejandro R. Mosteo
2016-06-03  7:26     ` Dmitry A. Kazakov [this message]
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