TutRwMutexReadLocked


Name

TutRwMutexReadLocked — check if a R/W mutex is read-locked by the current thread

Synopsis

T_BOOL TutRwMutexReadLocked(rw_mutex) 
T_RW_MUTEX rw_mutex; 

Arguments

rw_mutex — R/W mutex object to query

Return Values

TRUE if calling thread has been granted a read-lock, FALSE otherwise.

Diagnostics

If TutRwMutexReadLocked fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

TutRwMutexReadLocked checks if a R/W mutex is read-locked by the current thread.

Caution

None

See Also

TutRwMutexCreate, TutRwMutexWriteLocked

Examples

This example prints the calling thread’s current lock status:

void show_rw_lock(rw_mutex) 
T_RW_MUTEX rw_mutex; 
{ 
  if (TutRwMutexWriteLocked(rw_mutex)) { 
    TutOut("WRITE-LOCK"); 
  } 
  else if (TutRwMutexReadLocked(rw_mutex)) { 
    TutOut("READ-LOCK"); 
  } 
  else { 
    TutOut("NONE"); 
  } 
} 

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com