Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-08-20 19:37:51

Howard Hinnant wrote:

> I realize that this is stricter than POSIX, however I'm not sure that
> the difference in strictness has a practical consequence. We're
> talking about a condition which would be waited on with mutex1 by a
> group of threads, and then at some later date (synchronized properly
> so as not to overlap) waited on with mutex2. Do you have motivating
> use cases needing this functionality?

No, but I also have no motivating use cases needing the check when the
condition has been default-constructed.

> As far as overhead goes, I'm more concerned about space overhead than
> performance overhead. On Mac, sizeof(pthread_cond_t) is 28, and
> sizeof(pthread_mutex_t) is 44. I would really like for there to be be
> an option for sizeof(std::condition) to be as close to 44 as
> possible. Consider:
> class MyClass
> {
> std::tr2::upgrade_mutex mut_;
> ...
> };
> MyClass already has two std::condition's buried under the
> upgrade_mutex (at least by my reference implementation).

I believe that the main cost of a mutex or a condition is measured in kernel
objects, not bytes. One will typically run out of kernel memory much
earlier, IMO.

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