Boost logo

Boost :

Subject: Re: [boost] [winrt support] Adding support for Windows 8 store/phone to Boost libraries
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2014-04-29 10:28:38

On 29 Apr 2014 at 16:49, Andrey Semashev wrote:

> > BTW, I'll shortly be coming to this list with a new sync object for
> > Boost.Thread called a "permit object" which wraps the failed POSIX
> > pthreads permit object proposal for C11 which solves some of the
> > problems of using condition variables directly.
> <offtopic> I believe, the general target for low-level thread
> synchronization should be Boost.Sync. It's a little in a hanging state
> now, but in the long term it should supersede Boost.Thread
> synchronization primitives. That said, I'm not aware of "permit
> objects", so I don't know how well it would fit in Boost.Sync.
> </offtopic>

I should stress what I'm about to say is too early, because the Boost
permit object is not yet ready, so please wait until next week for
further discussion. However, I can tell you that the permit object
implementation remains a completely standalone new POSIX pthreads
object written in C. All the proposed boost::permit<> object does is
to wrap that C object - and in fact, boost/thread/permit.hpp is quite
literally a copy and paste of
boost/thread/posix/condition_variable.hpp with every instance of
pthread_cond_whatever replaced with pthread_permit_whatever. And of
course a few small modifications to allow a pthread API to work
correctly on Windows (the C permit object works on Windows) and to
support thread interruptions etc.

In other words, if you wanted to add the permit to Boost.Sync, it
ought to be absolutely trivial. Whatever refactor you're doing for
condition_variable (POSIX implementation) you repeat on permit, and
you're done.

Please do wait till next week though. I am currently writing a load
soak test for Boost.Thread which tests mutexes, condvars and permits
for perfection under heavy CPU load sustained over minutes or hours.
As you may know, there have been some problems with Thread on Mac OS
X, hopefully this test might illuminate the cause. I also don't want
to bring boost::permit<> to here until I can prove it is perfect and
has significant advantages over condvars for its particular use
cases. As you know, it is extremely easy to accidentally have some
extremely rare race condition in threading primitives, so on those I
am extra special cautious.


Currently unemployed and looking for work in Ireland.
Work Portfolio:

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