Should the mutex operation throw a system_error for locking twice? [duplicate]

This is undefined behavior. If we look at [mutex.requirements.mutex], it has a prerequisite that the calling thread does not own the mutex, and a postcondition that the calling thread does own the mutex. device_or_resource_busy pertains to when ANOTHER calling thread tries to lock the mutex. However, it's implementation-defined whether or not resource_deadlock_would_occur is thrown.

This question is a duplicate of Why is locking a std::mutex twice 'Undefined Behaviour'?