Boost logo

Boost :

From: Iain.Hanson_at_[hidden]
Date: 2001-05-23 10:49:21

     It looks to me as though atomic_t should be templatedised on value
     type. This would have the advantage of shrinking its memory footprint
     to those member fuctions used.
     What behavior would you want of a counter once it reached the max
     value for the value type. Should it wrap or latch?
     Which additional operations do you need on a counter? Normally,
     counters can have an arbitary value added or subtracted in addition to
     inc and dec, but it does not normally make sense to negate or
     otherwise perform bitwise operations on a counter?

______________________________ Reply Separator _________________________________
Subject: Re: [boost] Re: New file uploaded to boost
Author: bdawes (bdawes_at_[hidden]) at unix,mime
Date: 22/05/01 22:27

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.
To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
Your use of Yahoo! Groups is subject to

Visit our website at

This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.

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