From: David Abrahams (abrahams_at_[hidden])
Date: 2001-04-20 10:47:11
----- Original Message -----
From: "Beman Dawes" <bdawes_at_[hidden]>
> I'm trying to write a multi-threaded program using the Boost.Threads
> prototype and the bounded queue prototype. In general, the experience has
> been a pleasant one.
> The one need I had that wasn't met was for a portable integer type which
> could be shared between threads. Even thought my program is small, it has
> this need at least three times.
> atomic_t won't do; it is intended for very efficient access to underlying
> atomic hardware types and so leaves too much unspecified. The value_type
> isn't specified as signed, and could be as small as a char.
> What I really need is a shared_int_least32_t. Portability is the issue,
> not speed. I guess internally on some platforms that means an
> int_least32_t protected by a mutex, although there may be may be more
> efficient implementations on other platforms.
> There have been a number of prior postings suggesting in effect that
> atomic_t be respecified so that value_type is at least an int. But that
> defeats atomic_t's original purpose, if I understand correctly.
I'm not sure. How many of us would be willing to do general threadsafe
reference-counting with 8 bits?
> So should Boost.Threads include (in addition to atomic_t) a
> shared_int_least32_t type that may be slower, but allows portable use
> across all platforms?
Well, at the very least a shared_int_least16_t, which is what "at least an
int" above means, in principle. I'd rather have both, though ;-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk