comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: How to transfer Class-Wide object to a Task ?
Date: Tue, 15 Oct 2019 09:21:48 +0200
Date: 2019-10-15T09:21:48+02:00	[thread overview]
Message-ID: <qo3s2b$1hlc$1@gioia.aioe.org> (raw)
In-Reply-To: 5da4e182$0$20321$426a74cc@news.free.fr

On 2019-10-14 22:58, William FRANCK wrote:

> Here is the multitasking part (simplified) (working, no issue)
> for reading the datafile, and writing it back (after some data-process)
> 
> My first intention was : while Writing.Bloc is busy writing on the 
> output file, Reading.Bloc can take 1 record in advance

That is what OS asynchronous I/O does already. But that is aside.

> Now I have to insert the class-wide object passing in the Bloc.

Stream attributes 'Input and 'Output would do.

> As You mentionned, should I use a protected type (FIFO)  instead of 2 // 
> tasks ?

A protected object to synchronize two tasks:

    Producer -> FIFO -> Consumer
     Block put <- PO -> Block get
     when full          when empty

FIFO does not need interlocking in this scenario. Protected object is 
only to prevent busy waiting at the ends.

Since you are working with streams you can use a storage stream instead 
of raw FIFO:

    Producer -> Storage stream -> Consumer
    Block write when full    Block read when empty

I still do not understand why you serialize and deserialize insted of 
copying bytes as they are.

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

  parent reply	other threads:[~2019-10-15  7:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14 19:41 How to transfer Class-Wide object to a Task ? William FRANCK
2019-10-14 19:55 ` Shark8
2019-10-14 20:48   ` William FRANCK
2019-10-14 22:01     ` Shark8
2019-10-15  5:13       ` William FRANCK
2019-10-14 19:58 ` Dmitry A. Kazakov
2019-10-14 20:58   ` William FRANCK
2019-10-15  4:40     ` Per Sandberg
2019-10-15  5:40       ` William FRANCK
2019-10-16 20:04       ` William FRANCK
2019-10-16 23:43         ` Anh Vo
2019-10-17  9:28         ` William FRANCK
2019-10-17 10:00           ` Dmitry A. Kazakov
2019-10-17 10:45             ` William FRANCK
2019-10-15  7:21     ` Dmitry A. Kazakov [this message]
2019-10-15 14:31       ` Optikos
2019-10-15 19:41         ` William FRANCK
2019-10-15 20:03           ` Shark8
2019-10-14 20:21 ` William FRANCK
2019-10-14 20:32   ` Dmitry A. Kazakov
2019-10-14 21:04     ` William FRANCK
2019-10-14 21:57   ` Shark8
2019-10-15  5:43     ` William FRANCK
replies disabled

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