From 30.4.1 ("Mutex requirements"):
The expression
m.lock()
shall be well-formed and have the following semantics:Requires: If
m
is of typestd::mutex
orstd::timed_mutex
, the calling thread does not own the mutex.
You're violating the requirements, and so you cannot expect any behaviour guaranteed by the standard.