Re: FIFOs.
Re: FIFOs.
- Subject: Re: FIFOs.
- From: Peter Ammon <email@hidden>
- Date: Tue, 11 Sep 2001 15:23:59 -0400
On Tuesday, September 11, 2001, at 12:14 AM, jgo wrote:
From: Ondra Cada <email@hidden>
To: "John C. Randolph" <email@hidden>
Date: Mon, 2001-08-20 16:00:39 +0200
John C. Randolph (JCR) wrote at Mon, 2001-08-20 06:45:10 -0700:
I want a FIFO implemented as a proper thread-safe ring buffer that
will
grow as necessary to prevent overflow, and avoid needless shuffling of
memory as your example will do. I want this FIFO to be writeable by
one
thread while being read by another.
The "memory shuffling" is a roaring nonsense.
Object "clutter" is roaring nonsense.
There just might be one application from 10000 which *MIGHT*
have such demands that NSMutableArray-based FIFO would be
unuseable there, but even that I doubt.
Ah, there you go, again, violating encapsulation by having the
framework/class using developer concerned with the implementation.
The problem with cobbling NSMutableArray is merely that
it is NOT a queue/FIFO, it is not a stack/LIFO; it's an array.
I seem to remember a discussion about this before, where it was revealed
that NSArrays are actually implemented as circular buffers. The memory
shuffling might be less than you think.
You can always download Darwin and check out the implementation of
CFArray.
-Peter
- Follow-Ups:
- Re: FIFOs.
- From: "Clark S. Cox III" <email@hidden>
References: | |
| >Re: FIFOs. (From: jgo <email@hidden>) |