TutRwMutexSetReadQuota


Name

TutRwMutexSetReadQuota — set the simultaneous reader quota of a R/W mutex

Synopsis

T_BOOL TutRwMutexSetReadQuota(rw_mutex, read_quota) 
T_RW_MUTEX rw_mutex; 
T_INT4 read_quota; 

Arguments

rw_mutex — R/W mutex object to update

read_quota — number of simultaneous readers to be supported

Return Values

TRUE if the operation was successful, FALSE otherwise.

Diagnostics

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

Description

TutRwMutexSetReadQuota can be used to reset the reader quota assigned to a R/W mutex. The quota tracks the number of reader-threads that have locked a R/W mutex concurrently. In some circumstances it may be desirable to reset the quota to a baseline value after it has grown dynamically, or to increase it in a single operation in anticipation of an increase in concurrent utilization. The valid range is from 1 to T_MAX_READ_QUOTA, inclusive.

Caution

TutRwMutexSetReadQuota obtains a write-lock on the R/W mutex before it changes the quota.

See Also

TutRwMutexCreate, TutRwMutexGetReadQuota, TutRwMutexReadLock

Examples

This example sets the reader quota of the R/W mutex to 8:

T_RW_MUTEX rw_mutex; 
. 
. 
. 
if (!TutRwMutexSetReadQuota(rw_mutex, 8)) { 
  /* error */ 
} 

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