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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.83.132 with SMTP id n126mr1242991itb.11.1513157109689; Wed, 13 Dec 2017 01:25:09 -0800 (PST) X-Received: by 10.157.83.199 with SMTP id i7mr74146oth.3.1513157108649; Wed, 13 Dec 2017 01:25:08 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!paganini.bofh.team!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!193no160280itr.0!news-out.google.com!s63ni654itb.0!nntp.google.com!193no160278itr.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 13 Dec 2017 01:25:08 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=134.206.121.213; posting-account=O_NgcgoAAABs6pgCjroQBmOBL5ZZGPUc NNTP-Posting-Host: 134.206.121.213 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9d05ffbc-d36d-423c-a6d4-515bbb6012e7@googlegroups.com> Subject: Re: weird block on Get from basic protected bounded buffer with 2 tasks From: George Shapovalov Injection-Date: Wed, 13 Dec 2017 09:25:09 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:49469 Date: 2017-12-13T01:25:08-08:00 List-Id: On Tuesday, December 12, 2017 at 10:16:07 PM UTC+1, Dmitry A. Kazakov wrote= : > On 2017-12-12 20:08, George Shapovalov wrote: > Then the barrier must be > Count =3D 0 or else (Count < maxCount and then Get'Count =3D 0) > BTW, prioritizing is a bad idea. If you enforce entry order you also=20 Thank you for the hint on the barriers. Although yes, this was not the inte= ntion, I added that 'Count dependency to see if it helps to resolve that "b= lock". The original implementation was plain as in textbook.. Now, I am "happy" to report that the issue got "resolved" - all quoted, bec= ause it simply "just started working". The bigger program, not this example= . There were no aborts in it and I even tried to run the LogBuffer.getEvent= from the main loop..=20 The bigger code was using synchronized interface with a printEvent(logBuf_I= nt'Class) procedure and then implementing actual buffer as a protected type= (overriding Get and Put). That class-wide printEvent was essentially calli= ng Buffer.Get and then Print(record) (plain type, basic IO - the base idea = was to decouple logging and IO, so this was just a "smart wrapper"). Like t= his: procedure PrintEvent(LI : in out EventLogger_Interface'Class) is ev : Event_Rec; begin LI.GetEvent(ev); -- was not returning from this before Put_Line("report point"); -- was never called here earlier PrintEvent(ev); -- regular procedure on basic record type calling IO end; Weird thing, it was blocking with Buffer.printEvent (class-wide wrapper) in= main cycle. But then when I replaced it with two explicit calls (Get then = Print) it unblocked and started working as expected.. And then I prepared a= n update of that simplified code, to include this, but it kept working in t= he sample code even with Buffer.printItem.. So, I went back and changed cod= e back to Buffer.printItem in the main cycle - and it kept working now with= the "big code" too! And I just run a diff against last commit that was blo= cking - and there are absolutely no changes aside few cosmetics! So, yeah, I am glad of course it works now, but it really seems like "block= ing on Tuesdays" issue right now..=20