From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!x6YkKUCkj2qHLwbKnVEeag.user.46.165.242.91.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Custom Storage Pool questions Date: Sun, 3 Oct 2021 10:52:35 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <9bc55d72-b90e-45c5-bfd8-cbce565d139dn@googlegroups.com> <44be7c73-f69e-45da-9916-b14a43a05ea3n@googlegroups.com> <6a073ced-4c3b-4e87-8063-555a93a5c3f6n@googlegroups.com> <3ab4890a-7787-480b-b44b-5189309c8693n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: gioia.aioe.org; logging-data="10947"; posting-host="x6YkKUCkj2qHLwbKnVEeag.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:62929 List-Id: On 2021-10-03 01:19, Jere wrote: > I was thinking more along the lines of adding a classwide operation on the > root storage pool type. You don't need that. As I proposed in another response, one add a new primitive operations: procedure Allocate_Segment ( Pool : in out Root_Storage_Pool; Storage_Address : out Address; Size : Storage_Count; Alignment : Storage_Count; Sequence_No : Positive ); Note, it is not abstract. The implementation dispatches to Allocate: procedure Allocate_Segment ( Pool : in out Root_Storage_Pool; Storage_Address : out Address; Size : Storage_Count; Alignment : Storage_Count; Head : Address; -- The first block address Sequence_No : Positive ) is begin Root_Storage_Pool'Class (Pool).Allocate ( Storage_Address, Size, Alignment ); end Allocate_Segment; Similarly goes Deallocate_Segment. The object allocation protocol: Take mutex Allocate (...); -- The head, passed down in further calls Allocate_Segment (..., 1); -- First auxiliary block ... Allocate_Segment (..., N); -- Last auxiliary block Release mutex Deallocation protocol: Take mutex Dellocate_Segment (..., 1); -- Last auxiliary block ... Dellocate_Segment (..., N); -- First auxiliary block Deallocate (...); -- The head Release mutex That is 100% backward compatible. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de