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 10.36.245.195 with SMTP id k186mr20197995ith.5.1471988076914; Tue, 23 Aug 2016 14:34:36 -0700 (PDT) X-Received: by 10.157.44.69 with SMTP id f63mr1683890otb.2.1471988076886; Tue, 23 Aug 2016 14:34:36 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!f6no12429744ith.0!news-out.google.com!d130ni44712ith.0!nntp.google.com!f6no12429737ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 23 Aug 2016 14:34:36 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2001:8a0:6a4f:fe01:d8f1:ac77:fb4c:e02c; posting-account=nd46uAkAAAB2IU3eJoKQE6q_ACEyvPP_ NNTP-Posting-Host: 2001:8a0:6a4f:fe01:d8f1:ac77:fb4c:e02c References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <32c0ac79-0f82-4ffa-b38e-7733e817f35a@googlegroups.com> Subject: Re: How do I get an enctry in a protected object to block until a certain item arrives from a producer task? From: Some Dude Injection-Date: Tue, 23 Aug 2016 21:34:36 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:31525 Date: 2016-08-23T14:34:36-07:00 List-Id: Thanks a lot! I think I will have to switch to Dmitry's suggestion with the requeue approach. Here is Egil's modification from Stackexchange: protected type Reply_Queue is procedure Put (Event : Event_Type); entry Take (Command_Id_Type) (Event : out Event_Type); private Storage : Reply_Storage.Map; end Reply_Queue; protected body Reply_Queue is procedure Put (Event : Event_Type) is Id : Command_Id_Type := Event_Command_Id (Event); begin Storage.Insert (Id, Event); end Put; entry Take (for Id in Command_Id_Type) (Event : out Event_Type) when Storage.Contains(Id) is begin Event := Storage.Element (Id); Storage.Delete (Id); end Take; end Reply_Queue; Curiously, it does not work for this definition: subtype Command_Id_Type is Natural; But compiles first for this one: type Command_Id_Type is new Integer range 0 .. Integer'Last-1; However, linking fails: /home/nemo/git/ada/bham/obj/bham.o: In function `bham__connection_handlerTKB': bham.adb:(.text+0x1300a): relocation truncated to fit: R_X86_64_32 against `.bss' /home/nemo/git/ada/bham/obj/bham.o: In function `bham__open_local_connection': bham.adb:(.text+0x143ca): relocation truncated to fit: R_X86_64_PC32 against `.bss' /home/nemo/git/ada/bham/obj/bham.o: In function `bham__close_all': bham.adb:(.text+0x14415): relocation truncated to fit: R_X86_64_PC32 against `.bss' /home/nemo/git/ada/bham/obj/bham.o: In function `bham__send_sync': bham.adb:(.text+0x145aa): relocation truncated to fit: R_X86_64_PC32 against `.bss' /home/nemo/git/ada/bham/obj/bham.o: In function `bham__finalize_body': bham.adb:(.text+0x15c9b): relocation truncated to fit: R_X86_64_32 against `.bss' /home/nemo/git/ada/bham/obj/bham.o: In function `bham___elabb': bham.adb:(.text+0x161f0): relocation truncated to fit: R_X86_64_32 against `.bss' bham.adb:(.text+0x16203): relocation truncated to fit: R_X86_64_32 against `.bss' bham.adb:(.text+0x16250): relocation truncated to fit: R_X86_64_32 against `.bss' collect2: error: ld returned 1 exit status gprbuild: link of test.adb failed [2016-08-23 22:11:53] process exited with status 4, 100% (3/3), elapsed time: 01.36s What do these messages even mean?