Suppose thread 1 creates a lock dynamically (but does not lock it). Then, suppose Thread 2 locks the lock, then goes out of existence. Will thread 1 be able to delete the lock since it was left locked by the now non-existent thread 2?
Printable View
Suppose thread 1 creates a lock dynamically (but does not lock it). Then, suppose Thread 2 locks the lock, then goes out of existence. Will thread 1 be able to delete the lock since it was left locked by the now non-existent thread 2?
No. A locked pthread_mutex_t can not be destroyed. In fact, your program shouldn't even be able to close correctly. If you are using another threading library, then you'll have to check the docs.