[Prev] [Contents] [Next]

Mutexes return EDEADLK when re-locked by owner

Some threads implementations return the EDEADLK error when a mutex attempts to relock a mutex that it already owns. The Posix standard specifies that the results are undefined when a mutex is re-locked by the owner. The Single Unix Specification addresses these issues by providing a new mutex attribute called `type'.

The AS/400 threads support takes the same implementation route that the Single Unix Specification suggests, and also causes the thread to deadlock when it attempts to relock a normal (non-recursive) mutex. Because many users of pthreads don't check return codes from functions, the deadlock scenario will protect applications from corrupted data that might result if they attempt to relock an already held mutex, then unlock the mutex as if the lock was successful.

See "pthread_mutexattr_gettype()--Get Mutex Type Attribute" and "pthread_mutexattr_settype()--Set Mutex Type Attribute" if your application requires error checking mutexes.



[Prev] [Contents] [Next]
Copyright © 1998, IBM Corporation. All rights reserved.
Comments? Contact
rchthrds@us.ibm.com