Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Life sucks, but death doesn't put out at all...." -- Thomas J. Kopp


devel / comp.lang.c++ / Re: std::unique_lock - Cannot lock twice?

SubjectAuthor
* Re: std::unique_lock - Cannot lock twice?nan dhan
`* Re: std::unique_lock - Cannot lock twice?Chris M. Thomasson
 +* Re: std::unique_lock - Cannot lock twice?Chris M. Thomasson
 |`* Re: std::unique_lock - Cannot lock twice?Ralf Fassel
 | +- Re: std::unique_lock - Cannot lock twice?Chris M. Thomasson
 | `- Re: std::unique_lock - Cannot lock twice?Chris M. Thomasson
 `* Re: std::unique_lock - Cannot lock twice?Chris M. Thomasson
  `- Re: std::unique_lock - Cannot lock twice?Chris M. Thomasson

1
Re: std::unique_lock - Cannot lock twice?

<030a7866-60af-4595-89ca-65511d888d75n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=321&group=comp.lang.c%2B%2B#321

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:622a:189b:b0:3f6:c440:77a5 with SMTP id v27-20020a05622a189b00b003f6c44077a5mr1842111qtc.9.1686233110446;
Thu, 08 Jun 2023 07:05:10 -0700 (PDT)
X-Received: by 2002:a05:622a:1a9b:b0:3f9:7251:3107 with SMTP id
s27-20020a05622a1a9b00b003f972513107mr1952700qtc.7.1686233110145; Thu, 08 Jun
2023 07:05:10 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Thu, 8 Jun 2023 07:05:09 -0700 (PDT)
In-Reply-To: <20170309000955.596e6b31@bother.homenet>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:8070:2483:9160:761f:c21b:2f0f:22e2;
posting-account=dCp3uQoAAADX7TewcC521otkqF_GIQUR
NNTP-Posting-Host: 2a02:8070:2483:9160:761f:c21b:2f0f:22e2
References: <8d0c2e10-4c87-4b1e-9800-67be6a3e0e35@googlegroups.com> <20170309000955.596e6b31@bother.homenet>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <030a7866-60af-4595-89ca-65511d888d75n@googlegroups.com>
Subject: Re: std::unique_lock - Cannot lock twice?
From: ee201601@gmail.com (nan dhan)
Injection-Date: Thu, 08 Jun 2023 14:05:10 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: nan dhan - Thu, 8 Jun 2023 14:05 UTC

On Thursday, March 9, 2017 at 1:10:08 AM UTC+1, Chris Vine wrote:
> On Wed, 8 Mar 2017 14:57:09 -0800 (PST)
> Christopher <christo...@gmail.com> wrote:
> > I debugged an application to the following scenario:
> >
> >
> > #include <mutex>
> >
> > std::mutex g_mutex;
> >
> > int main()
> > {
> >
> > std::unique_lock<std::mutex> lock(g_mutex);
> > lock.release();
> > lock.lock();
> > lock.release();
> > }
> >
> >
> > This throws on the second attempt to lock.
> > I thought the difference between unique lock and lock guard was that
> > unique lock allowed manually locking and unlocking. We cannot lock it
> > twice?
> You want lock.unlock(), not lock.release(). With
> std::unique_lock::release(), the mutex remains locked after the call
> (the unique_lock just ceases to manage/own it).

You have to use lock.unlock() instead of release(). Because release breaks the association of the mutex and not unlocks it.. so using unlock instead of release should solve.

Re: std::unique_lock - Cannot lock twice?

<u5t95l$1jfil$6@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=325&group=comp.lang.c%2B%2B#325

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: std::unique_lock - Cannot lock twice?
Date: Thu, 8 Jun 2023 12:11:48 -0700
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <u5t95l$1jfil$6@dont-email.me>
References: <8d0c2e10-4c87-4b1e-9800-67be6a3e0e35@googlegroups.com>
<20170309000955.596e6b31@bother.homenet>
<030a7866-60af-4595-89ca-65511d888d75n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 8 Jun 2023 19:11:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6f3ff3b36175b4a8ca61c5b328805df5";
logging-data="1687125"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/RMOsQ6+OA12EFR6qS9obthFJBcUmJANI="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.11.2
Cancel-Lock: sha1:BfMXmcTaDr4H/bgpcU8DKn2GSbg=
Content-Language: en-US
In-Reply-To: <030a7866-60af-4595-89ca-65511d888d75n@googlegroups.com>
 by: Chris M. Thomasson - Thu, 8 Jun 2023 19:11 UTC

On 6/8/2023 7:05 AM, nan dhan wrote:
> On Thursday, March 9, 2017 at 1:10:08 AM UTC+1, Chris Vine wrote:
>> On Wed, 8 Mar 2017 14:57:09 -0800 (PST)
>> Christopher <christo...@gmail.com> wrote:
>>> I debugged an application to the following scenario:
>>>
>>>
>>> #include <mutex>
>>>
>>> std::mutex g_mutex;
>>>
>>> int main()
>>> {
>>>
>>> std::unique_lock<std::mutex> lock(g_mutex);

_________________________
>>> lock.release();
>>> lock.lock();
>>> lock.release();
>>> }
_________________________

lock.unlock();
lock.lock();
lock.unlock();

?

>>>
>>>
>>> This throws on the second attempt to lock.
>>> I thought the difference between unique lock and lock guard was that
>>> unique lock allowed manually locking and unlocking. We cannot lock it
>>> twice?
>> You want lock.unlock(), not lock.release(). With
>> std::unique_lock::release(), the mutex remains locked after the call
>> (the unique_lock just ceases to manage/own it).
>
> You have to use lock.unlock() instead of release(). Because release breaks the association of the mutex and not unlocks it.. so using unlock instead of release should solve.

Re: std::unique_lock - Cannot lock twice?

<u60h5m$21uee$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=328&group=comp.lang.c%2B%2B#328

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: std::unique_lock - Cannot lock twice?
Date: Fri, 9 Jun 2023 17:46:46 -0700
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <u60h5m$21uee$2@dont-email.me>
References: <8d0c2e10-4c87-4b1e-9800-67be6a3e0e35@googlegroups.com>
<20170309000955.596e6b31@bother.homenet>
<030a7866-60af-4595-89ca-65511d888d75n@googlegroups.com>
<u5t95l$1jfil$6@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 10 Jun 2023 00:46:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0e194645d8ccf5f55029a75233ccc80a";
logging-data="2161102"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UIvWdkiNdpJRLNNHSAPNqxRsMqEZmTBQ="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:BZwM9PEtbtO+MvsCcT0ea3HR1h8=
Content-Language: en-US
In-Reply-To: <u5t95l$1jfil$6@dont-email.me>
 by: Chris M. Thomasson - Sat, 10 Jun 2023 00:46 UTC

On 6/8/2023 12:11 PM, Chris M. Thomasson wrote:
> On 6/8/2023 7:05 AM, nan dhan wrote:
>> On Thursday, March 9, 2017 at 1:10:08 AM UTC+1, Chris Vine wrote:
>>> On Wed, 8 Mar 2017 14:57:09 -0800 (PST)
>>> Christopher <christo...@gmail.com> wrote:
>>>> I debugged an application to the following scenario:
>>>>
>>>>
>>>> #include <mutex>
>>>>
>>>> std::mutex g_mutex;
>>>>
>>>> int main()
>>>> {
>>>>
>>>> std::unique_lock<std::mutex> lock(g_mutex);
>
>
> _________________________
>>>> lock.release();
>>>> lock.lock();
>>>> lock.release();
>>>> }
> _________________________
>
> lock.unlock();
> lock.lock();
> lock.unlock();
[...]

No! Shit man. Wait a minute. Self SLAP!!!!!

std::unique_lock<std::mutex> lock(g_mutex); --> LOCK

lock.unlock(); --> UNLOCK
lock.lock(); --> LOCK
lock.unlock(); --> UNLOCK

You need another lock _before_ that dtor of:

std::unique_lock<std::mutex> lock(g_mutex);

automatically unlocks! God damn it!

Re: std::unique_lock - Cannot lock twice?

<u60h9v$21uee$3@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=329&group=comp.lang.c%2B%2B#329

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: std::unique_lock - Cannot lock twice?
Date: Fri, 9 Jun 2023 17:49:02 -0700
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <u60h9v$21uee$3@dont-email.me>
References: <8d0c2e10-4c87-4b1e-9800-67be6a3e0e35@googlegroups.com>
<20170309000955.596e6b31@bother.homenet>
<030a7866-60af-4595-89ca-65511d888d75n@googlegroups.com>
<u5t95l$1jfil$6@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 10 Jun 2023 00:49:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0e194645d8ccf5f55029a75233ccc80a";
logging-data="2161102"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+8L7brUTpBeJ/5ErbYk4LNrfhUpGbU9iE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:eAtruLJIGlfCl1e/vZZ18z9qMdM=
In-Reply-To: <u5t95l$1jfil$6@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Sat, 10 Jun 2023 00:49 UTC

On 6/8/2023 12:11 PM, Chris M. Thomasson wrote:
> On 6/8/2023 7:05 AM, nan dhan wrote:
>> On Thursday, March 9, 2017 at 1:10:08 AM UTC+1, Chris Vine wrote:
>>> On Wed, 8 Mar 2017 14:57:09 -0800 (PST)
>>> Christopher <christo...@gmail.com> wrote:
>>>> I debugged an application to the following scenario:
>>>>
>>>>
>>>> #include <mutex>
>>>>
>>>> std::mutex g_mutex;
>>>>
>>>> int main()
>>>> {
>>>>
>>>> std::unique_lock<std::mutex> lock(g_mutex);
>
>
> _________________________
>>>> lock.release();
>>>> lock.lock();
>>>> lock.release();
>>>> }
> _________________________

^^^^^^^^^^^^

The dtor of the damn lock will unlock the mutex. The mutex needs to be
in a locked state before the scope goes out and unlocks it itself!

Sorry!

Re: std::unique_lock - Cannot lock twice?

<ygawn06f4dm.fsf@akutech.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=371&group=comp.lang.c%2B%2B#371

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.c++
Subject: Re: std::unique_lock - Cannot lock twice?
Date: Wed, 14 Jun 2023 17:30:29 +0200
Lines: 21
Message-ID: <ygawn06f4dm.fsf@akutech.de>
References: <8d0c2e10-4c87-4b1e-9800-67be6a3e0e35@googlegroups.com>
<20170309000955.596e6b31@bother.homenet>
<030a7866-60af-4595-89ca-65511d888d75n@googlegroups.com>
<u5t95l$1jfil$6@dont-email.me> <u60h5m$21uee$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net i105FprelFlM6Ioe+wg9DgO41nkamNt2W+mh0R8tJSpbgfiAM=
Cancel-Lock: sha1:ZRdoglKjsxZAMbwQuTqdVgSh0tM= sha1:Gi/Ut8FI+t4WJAeGsxBf6Cs7vEg=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 by: Ralf Fassel - Wed, 14 Jun 2023 15:30 UTC

* "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
| std::unique_lock<std::mutex> lock(g_mutex); --> LOCK
>
| lock.unlock(); --> UNLOCK
| lock.lock(); --> LOCK
| lock.unlock(); --> UNLOCK
>
| You need another lock _before_ that dtor of:

I don't think this is true:

https://en.cppreference.com/w/cpp/thread/unique_lock/%7Eunique_lock

~unique_lock();
Destroys the lock. If *this has an associated mutex and has acquired
ownership of it, the mutex is unlocked.

Note the conditional on unlocking the mutex in the DTOR.

R'

Re: std::unique_lock - Cannot lock twice?

<u6dcmd$4gto$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=390&group=comp.lang.c%2B%2B#390

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: std::unique_lock - Cannot lock twice?
Date: Wed, 14 Jun 2023 14:50:05 -0700
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <u6dcmd$4gto$2@dont-email.me>
References: <8d0c2e10-4c87-4b1e-9800-67be6a3e0e35@googlegroups.com>
<20170309000955.596e6b31@bother.homenet>
<030a7866-60af-4595-89ca-65511d888d75n@googlegroups.com>
<u5t95l$1jfil$6@dont-email.me> <u60h5m$21uee$2@dont-email.me>
<ygawn06f4dm.fsf@akutech.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 14 Jun 2023 21:50:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b1c4e4b19f19fc3650e51f0f655f2a97";
logging-data="148408"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199brYVNjlb6xcpYfg7XuxeK7eZ0Mackvk="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:hGdRorVqymIvnvXxgsAreNOKfkE=
Content-Language: en-US
In-Reply-To: <ygawn06f4dm.fsf@akutech.de>
 by: Chris M. Thomasson - Wed, 14 Jun 2023 21:50 UTC

On 6/14/2023 8:30 AM, Ralf Fassel wrote:
> * "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
> | std::unique_lock<std::mutex> lock(g_mutex); --> LOCK
>>
> | lock.unlock(); --> UNLOCK
> | lock.lock(); --> LOCK
> | lock.unlock(); --> UNLOCK
>>
> | You need another lock _before_ that dtor of:
>
> I don't think this is true:
>
> https://en.cppreference.com/w/cpp/thread/unique_lock/%7Eunique_lock
>
> ~unique_lock();
>
> Destroys the lock. If *this has an associated mutex and has acquired
> ownership of it, the mutex is unlocked.
>
> Note the conditional on unlocking the mutex in the DTOR.

The release can be fairly dangerous.

{
std::unique_lock<std::mutex> lock(g_mutex);
// foo bar baz
}

The mutex gets locked, and automatically unlocked at the end of the
scope, right? Be very careful when using release...

Re: std::unique_lock - Cannot lock twice?

<u6dcr2$4gto$3@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=391&group=comp.lang.c%2B%2B#391

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: std::unique_lock - Cannot lock twice?
Date: Wed, 14 Jun 2023 14:52:33 -0700
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <u6dcr2$4gto$3@dont-email.me>
References: <8d0c2e10-4c87-4b1e-9800-67be6a3e0e35@googlegroups.com>
<20170309000955.596e6b31@bother.homenet>
<030a7866-60af-4595-89ca-65511d888d75n@googlegroups.com>
<u5t95l$1jfil$6@dont-email.me> <u60h9v$21uee$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 14 Jun 2023 21:52:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b1c4e4b19f19fc3650e51f0f655f2a97";
logging-data="148408"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+gJ20Cm6R6uUrrAFtenFgkkMKCi03z8ps="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:uxTMFOUd2FoUXE+8BaGO/aDlzN8=
In-Reply-To: <u60h9v$21uee$3@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Wed, 14 Jun 2023 21:52 UTC

On 6/9/2023 5:49 PM, Chris M. Thomasson wrote:
> On 6/8/2023 12:11 PM, Chris M. Thomasson wrote:
>> On 6/8/2023 7:05 AM, nan dhan wrote:
>>> On Thursday, March 9, 2017 at 1:10:08 AM UTC+1, Chris Vine wrote:
>>>> On Wed, 8 Mar 2017 14:57:09 -0800 (PST)
>>>> Christopher <christo...@gmail.com> wrote:
>>>>> I debugged an application to the following scenario:
>>>>>
>>>>>
>>>>> #include <mutex>
>>>>>
>>>>> std::mutex g_mutex;
>>>>>
>>>>> int main()
>>>>> {
>>>>>
>>>>> std::unique_lock<std::mutex> lock(g_mutex);
>>
>>
>> _________________________
>>>>> lock.release();
>>>>> lock.lock();
>>>>> lock.release();
>>>>> }
>> _________________________
>
> ^^^^^^^^^^^^
>
> The dtor of the damn lock will unlock the mutex. The mutex needs to be
> in a locked state before the scope goes out and unlocks it itself!

I mistook release() for an unlock(). This can open a can of worms.
Actually, not exactly sure why unique_lock would even have a release
such that the dtor does not automatically unlock it. Sounds like a
nightmare deadlock waiting to happen.

Re: std::unique_lock - Cannot lock twice?

<u6ddcr$4gto$4@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=392&group=comp.lang.c%2B%2B#392

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: std::unique_lock - Cannot lock twice?
Date: Wed, 14 Jun 2023 15:02:02 -0700
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <u6ddcr$4gto$4@dont-email.me>
References: <8d0c2e10-4c87-4b1e-9800-67be6a3e0e35@googlegroups.com>
<20170309000955.596e6b31@bother.homenet>
<030a7866-60af-4595-89ca-65511d888d75n@googlegroups.com>
<u5t95l$1jfil$6@dont-email.me> <u60h5m$21uee$2@dont-email.me>
<ygawn06f4dm.fsf@akutech.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 14 Jun 2023 22:02:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="bc222fdc488b0299ae962f359e97db3d";
logging-data="148408"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9n2AbqNcgbmuW4uTJAR9m9RBvDN8JIYo="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:JGZkK3lsLm7blMVk6mY+ekIr9T4=
In-Reply-To: <ygawn06f4dm.fsf@akutech.de>
Content-Language: en-US
 by: Chris M. Thomasson - Wed, 14 Jun 2023 22:02 UTC

On 6/14/2023 8:30 AM, Ralf Fassel wrote:
> * "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
> | std::unique_lock<std::mutex> lock(g_mutex); --> LOCK
>>
> | lock.unlock(); --> UNLOCK
> | lock.lock(); --> LOCK
> | lock.unlock(); --> UNLOCK
>>
> | You need another lock _before_ that dtor of:
>
> I don't think this is true:
>
> https://en.cppreference.com/w/cpp/thread/unique_lock/%7Eunique_lock
>
> ~unique_lock();
>
> Destroys the lock. If *this has an associated mutex and has acquired
> ownership of it, the mutex is unlocked.
>
> Note the conditional on unlocking the mutex in the DTOR.

Yes. The damn acquire/release vs lock/unlock got me confused. Thanks for
the heads up Ralf!

Fwiw, I have had to use code where acquire and release actually meant
lock and unlock the mutex. Not alter the binding of the RAII object to
the underlying mutex itself!

ARGH!!!!

Sorry.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor