errorchecking_mutex will throw an exception if a thread attempts to lock a mutex that it has already locked, or if it attempts to unlock a mutex that is already unlocked or locked by a different thread.