Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-04-20 08:57:57

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.

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?


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