Opened 12 years ago

Closed 12 years ago

#5194 closed Bugs (invalid)

unique_lock::unlock() does not protect modification of is_locked with mutex

Reported by: Andrei Kazarov <Andrei.Kazarov@…> Owned by:
Milestone: To Be Determined Component: thread
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc:

Description

Shouldn't first is_locked=false and then m->unlock()? Otherwise is_locked value is undetermined in case of simultaneous calls to lock() and unlock()...

void unlock() { ... m->unlock(); is_locked=false; }

void lock() { ... m->lock(); is_locked=true; }

Change History (1)

comment:1 by Steven Watanabe, 12 years ago

Component: Nonethread
Resolution: invalid
Status: newclosed

A unique_lock is not intended to be accessed concurrently from multiple threads.

Note: See TracTickets for help on using tickets.