comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <nickroberts@callnetuk.com>
Subject: Re: How can I avoid Using a Semaphore?
Date: Wed, 17 Jan 2001 15:42:44 -0000
Date: 2001-01-17T15:42:44+00:00	[thread overview]
Message-ID: <94563n$cb6kp$1@ID-25716.news.dfncis.de> (raw)
In-Reply-To: 9BP86.270637$U46.8654942@news1.sttls1.wa.home.com

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?   ;-)






  reply	other threads:[~2001-01-17 15:42 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-13 16:18 How can I avoid Using a Semaphore? (long) DuckE
2001-01-15  1:06 ` How can I avoid Using a Semaphore? Nick Roberts
2001-01-15  3:17   ` Robert Dewar
2001-01-16  3:53   ` DuckE
2001-01-17 15:42     ` Nick Roberts [this message]
2001-01-20 18:16       ` DuckE
2001-01-20 19:16         ` Robert Dewar
2001-01-21  1:28           ` DuckE
2001-01-21 16:04             ` Robert Dewar
2001-01-21 23:23               ` DuckE
2001-01-22  0:28                 ` mark_lundquist
2001-01-22  1:51                 ` Robert Dewar
2001-01-23  2:36                   ` DuckE
2001-01-22  0:35               ` Built-in types (was " mark_lundquist
2001-01-22  1:54                 ` Robert Dewar
2001-01-22 16:18                   ` mark_lundquist
2001-01-22 17:20                     ` Robert Dewar
2001-01-22 23:17                       ` Mark Lundquist
     [not found]                         ` <m33deaaeks.fsf@ns40.infomatch.bc.ca>
2001-02-02 22:01                           ` Mark Lundquist
     [not found]                         ` <94km00$bv8$1@nnrp1.deja.com>
2001-02-02 22:03                           ` Mark Lundquist
2001-01-21 16:53           ` Nick Roberts
2001-01-21 18:24             ` Robert Dewar
2001-01-23  0:21               ` Nick Roberts
2001-01-22  0:16         ` mark_lundquist
2001-01-22 16:51 ` How can I avoid Using a Semaphore? (long) mark_lundquist
2001-01-23  6:02   ` DuckE
2001-02-02 22:00     ` Sucking (was Re: How can I avoid Using a Semaphore? (long)) Mark Lundquist
2001-02-03  1:44       ` Jeffrey Carter
2001-02-03  3:21       ` DuckE
2001-02-05 20:07         ` Mark Lundquist
2001-02-06  7:16           ` Sven Nilsson
2001-02-02 22:18     ` How can I avoid Using a Semaphore? (long) Mark Lundquist
2001-02-03  3:01       ` DuckE
2001-02-02 21:38 ` Niklas Holsti
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox