Problem with mutex.lock()

Konstantin Belousov kostikbel at gmail.com
Mon Feb 11 14:41:27 UTC 2019


On Mon, Feb 11, 2019 at 02:04:38PM +0000, Banta Plan wrote:
> I think you can reduce the problem to:
> ##
> int main() {
>     std::mutex m;
>     m.lock();
>     m.lock();
> 
>     return 0;
> }
> ##
> 
> This should deadlock.
Where is it specified that the program should deadlock ?
The behaviour for this case is undefined.

> But this will crash the program.
Which is not disallowed by standard.


More information about the freebsd-toolchain mailing list