NXMutexDepth

Determines the recursive depth of the specified mutex.

Library:LibC
Classification:NKS
Service:Synchronization

Syntax

  #include <nks/synch.h>
   
  int NXMutexDepth (
     NXMutex_t  *mutex);
  

Parameters

mutex

(IN) Points to the mutex.

Return Values

Returns the recursive depth of the mutex. This value is relevant only to a mutex created with the NX_MUTEX_RESURSIVE flag.

Remarks

By default, NKS mutexes are not recursive.

Each time a thread calls NXLock without having called NXUnlock, a count in a recursive mutex is incremented in place of attempting to acquire the mutex.

IMPORTANT:Attempting to acquire a non-recursive mutex a second time results in deadlock.

Calls to NXUnlock will decrement the recursive count until it reaches 0 at which time the mutex will be unlocked.

NOTE:Attempting to unlock a non-recursive mutex more than once results in an assertion at the application screen to this effect unless NDEBUG is defined in which case it might result in an error message at the NetWare console.

The NXMutexDepth function is for debug purposes only; you should not depend upon it for runtime operations or conditions. In production code, NDEBUG should be defined.

See Also

NXMutexAlloc