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.182.29.41 with SMTP id g9mr17664754obh.27.1456845732211; Tue, 01 Mar 2016 07:22:12 -0800 (PST) X-Received: by 10.182.246.104 with SMTP id xv8mr217777obc.1.1456845732184; Tue, 01 Mar 2016 07:22:12 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!ok5no5531400igc.0!news-out.google.com!pn7ni6751igb.0!nntp.google.com!hb3no10411420igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 1 Mar 2016 07:22:11 -0800 (PST) In-Reply-To: <87k2lmmf5w.fsf@mid.deneb.enyo.de> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=81.166.54.34; posting-account=bXa9kQoAAADQ0LSY80qTyLW4hcbm0Soz NNTP-Posting-Host: 81.166.54.34 References: <87k2lmmf5w.fsf@mid.deneb.enyo.de> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0e3fb431-ee4b-46ca-b1a5-a78e3245d7f3@googlegroups.com> Subject: Re: pragma Thread_Local_Storage on record? From: hanslad@gmail.com Injection-Date: Tue, 01 Mar 2016 15:22:12 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:29633 Date: 2016-03-01T07:22:11-08:00 List-Id: > I suspect that one of the components of type Core is itself a record > and has a component which is not statically initialized. Indeed, the Wait_Queue is a synchronized interface: generic type Element is private; package Buffers is type Buffer is synchronized interface; type Any_Buffer is access all Buffer'Class; Procedure Put(Buf: in out Buffer; Item: in Element) is abstract; Procedure Get(Buf: in out Buffer; Item: out Element) is abstract; end Buffers; =============================================================== with Buffers; generic package Buffers.Mailboxes is type Buffer_Store is array(Positive range <>) of Element; protected type MailBox(Max_Capacity : Positive) is new Buffer with overriding entry Put(Item : in Element); overriding entry Get(Item : out Element); private First : Positive := 1; Last : Positive := Max_Capacity; Number_In_Buffer : Natural := 0; Box_Store : Buffer_Store(1 .. Max_Capacity); end MailBox; end Buffers.Mailboxes; ==================================================================== package body Buffers.Mailboxes is protected body MailBox is entry Get(Item : out Element) when Number_In_Buffer /= 0 is begin Item := Box_Store(First); First := First mod Max_Capacity + 1; Number_In_Buffer := Number_In_Buffer - 1; end Get; entry Put(Item : in Element) when Number_In_Buffer /= Max_Capacity is begin Last := Last mod Max_Capacity + 1; Box_Store(Last):= Item; Number_In_Buffer := Number_In_Buffer + 1; end Put; function Buffer_Capacity return Positive is begin return Number_In_Buffer; end Buffer_Capacity; end MailBox; end Buffers.Mailboxes; Any idea on how I could implement such buffer in a Thread local data structure(record)? HP