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 X-Received: by 2002:a6b:1e05:: with SMTP id e5-v6mr2650991ioe.38.1524517843105; Mon, 23 Apr 2018 14:10:43 -0700 (PDT) X-Received: by 2002:a9d:5c8d:: with SMTP id a13-v6mr1509643oti.6.1524517842740; Mon, 23 Apr 2018 14:10:42 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!k65-v6no3335782ita.0!news-out.google.com!15-v6ni4054itg.0!nntp.google.com!f63-v6no3340716itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 23 Apr 2018 14:10:42 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=73.205.150.94; posting-account=Ru7E4QoAAAC_HiQ2D8LjZ7rh1mbTNcVn NNTP-Posting-Host: 73.205.150.94 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <5f7bce5c-b584-4cda-b1a7-2f3c7294d4ab@googlegroups.com> Subject: Re: A question about task's select delay alternative From: NiGHTS Injection-Date: Mon, 23 Apr 2018 21:10:43 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2390 X-Received-Body-CRC: 305573263 Xref: reader02.eternal-september.org comp.lang.ada:51688 Date: 2018-04-23T14:10:42-07:00 List-Id: On Monday, April 23, 2018 at 4:40:30 PM UTC-4, Dmitry A. Kazakov wrote: > On 2018-04-23 19:32, NiGHTS wrote: > > In a task with a select like this... > > > > task body X is > > begin > > loop > > select > > accept Y; > > or > > delay 10.0; > > exit; > > end select; > > end loop; > > end X; > > > > What does "delay" actually do to the CPU? In this case I am using the Adacore GNAT compiler for a PC. Is it a loop constantly evaluating elapsed time? Or is it some kind of timed interrupt? > > On most systems there is a way to do it in a non-busy manner. E.g. by > waiting for a system waitable object with 10s timeout under Windows or > doing same with a futex under Linux or by using pthreads API, whatever > pleases the Ada RTS provider. When the entry is accepted/completed by > the task scheduler, the object is signaled. Otherwise the timeout is > expired and the thread is released with a different return code. In > short, do not worry. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de Thank you for your input. I worry too much.