Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-05-22 16:27:53

At 04:09 PM 5/22/2001, williamkempf_at_[hidden] wrote:

>> The one need that keeps coming up is thread-safe counter known to
>hold at
>> least 32 bits.
>If we were to limit it I'd think it would be better to say at least
>sizeof(int) bits. I'm sure there are some architectures that would
>allow for efficient 16 bit atomic operations since an int is 16 bit
>there, while 32 bit atomic types would have to rely on the much
>slower mutex. At this point atomic_t could fit this bill simply by
>changing the documentation (i.e. the current implementation fits the
>bill any way).

I've run into the need for about a dozen counters now, and every one of
them had to be at least 32 bits. Slow, fast, it didn't matter, they had to
be at least 32 bits even on platforms where int is 16 bits.

The whole thing with atomic_t might be a red herring. It may well be that
thread_safe_int_least32_t needs a full set of integer operations. So even
if sizeof(int)==32, it can't just be a typedef for atomic_t.


Boost list run by bdawes at, gregod at, cpdaniel at, john at