Subject: Re: [boost] [thread] ~mutex and BOOST_VERIFY
From: Gaetano Mendola (mendola_at_[hidden])
Date: 2013-05-27 08:16:22


On 05/27/2013 01:39 PM, Peter Dimov wrote:
> Gaetano Mendola wrote:
>> > I will reintroduce the BOOST_VERIFY like this:
>> > ~mutex()
>> > {
>> >
>> > int ret;
>> > do
>> > {
>> >
>> > ret = pthread_mutex_destroy(&m);
>> >
>> > } while (ret == EINTR);
>> > BOOST_VERIFY(!ret);
>> >
>> > }
>
> I'm not sure that this is "correct". You don't know that pthread_mutex_destroy can be retried if it returns EINTR. It might well fail the second time.

I'm not the author of that, I just notice that in my old boost version the BOOST_VERIFY
was in place after our upgrade is not.
Looking at the SVN log before the modification the DTOR was this:

mutex::~mutex() { BOOST_VERIFY(!pthread_mutex_destroy(&m)); }

since in the ticket #6200 someone found out that some POSIX implementations can
return EINTR then the implementation of it was changed in what is the actual
status.

I have no idea what are the platforms with such behaviour so I can not even
say if it's possible to retry the destruction or not.

Regards
Gaetano Mendola