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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: open a file non-blocking ? Date: Mon, 26 Feb 2018 17:55:53 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <6c0d9514-97e0-4c5e-9b7d-b247c2ca0ced@googlegroups.com> NNTP-Posting-Host: b3/KWLDSh2Q785SrqKUcjA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.3 Xref: reader02.eternal-september.org comp.lang.ada:50653 Date: 2018-02-26T17:55:53+01:00 List-Id: On 2018-02-26 17:41, Jeffrey R. Carter wrote: >> On Saturday, February 24, 2018 at 2:42:30 PM UTC-5, >> pat...@spellingbeewinnars.org wrote: >> There does not seem to be an option to open a file non-blocking. Is >> there a way? > > I guess it depends on what you mean by non-blocking. Some of the > responses on here seem to think it means you can issue a write to the > file and it returns immediately, without waiting for the write to file > to complete. > > If that's the case, the normal way to deal with this within Ada is > something like [...] No, to my understanding the question was about using OS asynchronous I/O facilities rather than mimicking them on top of Ada blocking tasks. Apart from wasting resources it is not even close to be asynchronous in the sense of I/O. The monitor solution you described does not actually multiplex I/O requests. It does single *blocking* request at a time. As an example consider dealing with several sockets. With a socket selector all socket I/O is done concurrently. This is true asynchronous I/O. With a monitor task, only one socket can be serviced at a time. The difference in terms of data throughout and packet latencies will be gigantic. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de