TutCondWakeAll


Name

TutCondWakeAll — wake all threads waiting for a condition variable

Synopsis

T_BOOL TutCondWakeAll(cond) 
T_COND cond; 

Arguments

cond — condition variable whose waiting threads are to be awakened

Return Values

TRUE if threads were successfully awakened or if no threads were waiting on the specified condition variable, FALSE otherwise.

Diagnostics

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

Description

TutCondWakeAll wakes all threads that were waiting on the specified condition variable. A wake operation on a condition variable that does not have any waiting threads is not remembered. The next thread that waits on the condition variable blocks until the condition variable is again awakened.

Caution

None

See Also

TutCondCreate, TutCondWait

Examples

This example creates a condition variable and a mutex. It then wakes any threads waiting on the condition variable. Finally, it destroys both the condition variable and the mutex.

T_COND cond; 
T_MUTEX mutex; 
T_BOOL status; 
 
cond = TutCondCreate(); 
if (T_INVALID_COND == cond) { 
  /* error */ 
} 
 
mutex = TutMutexCreate(FALSE); 
if (T_INVALID_MUTEX == mutex) { 
  /* error */ 
} 
 
/* lock the mutex */ 
if (!TutMutexLock(mutex, T_TIMEOUT_FOREVER)) { 
  /* error */ 
} 
 
... 
 
/* unlock the mutex */ 
if (!TutMutexUnlock(mutex)) { 
  /* error */ 
} 
 
/* wake threads waiting for the condition */ 
if (!TutCondWakeAll(cond)) { 
  /* error */ 
} 
 
if (!TutCondDestroy(cond)) { 
  /* error */ 
} 
 
if (!TutMutexDestroy(mutex)) { 
  /* error */ 
} 

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