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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6f69b1cf0f02b9ac X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-17 14:25:03 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!ppp-3-250.5800-11.access.uk.worldonline.COM!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: How can I avoid Using a Semaphore? Date: Wed, 17 Jan 2001 15:42:44 -0000 Message-ID: <94563n$cb6kp$1@ID-25716.news.dfncis.de> References: <93ti8b$bjpps$1@ID-25716.news.dfncis.de> <9BP86.270637$U46.8654942@news1.sttls1.wa.home.com> NNTP-Posting-Host: ppp-3-250.5800-11.access.uk.worldonline.com (62.64.180.250) X-Trace: fu-berlin.de 979770295 12950169 62.64.180.250 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Xref: supernews.google.com comp.lang.ada:4123 Date: 2001-01-17T15:42:44+00:00 List-Id: Steve, what you're doing IS dynamic run-time allocation! The only difference is that you are doing it yourself, rather than getting Ada (or its runtime system) to do it for you. In this case, the problem of buffer allocation is 'orthogonal' to the problem of the synchronisation of tasks in passing data to one another through a buffer queue (perhaps 'pool' would be a better name then 'queue'). If you need to replace the default Ada allocation system with one of your own (e.g. for reasons of speed), you can do so by modifying my solution in two ways: (a) you can use "for Array_Access'Storage_Pool use My_Fast_Pool;" and then implement your own storage pool, My_Fast_Pool, according to RM95 13.11; (b) you can have a fixed-size byte array (preferably as a component inside the protected type Buffer_Queue, I think), and allocate and deallocate bytes within this array (doing so inside the protected entry Create and procedures Delete and Reset, to prevent inter-task interference), perhaps using the 'binary chop' scheme you use at the moment. As to writing data into the buffers (and then reading it back out), I'm pretty certain you want to use streams, instead of doing all the hard work yourself. See RM95 13.13. I hope this helps. (Am I missing something?*) PS: Purely out of idle curiosity, does your identifier style come from Smalltalk? (Or Modula?) Also, have you considered using UDP instead of TCP? -- Nick Roberts http://www.AdaOS.org *Yes I know, but am I missing something in Steve's problem? ;-)