pthread_rdwr.h File Reference

functions that provide a read-write locking mechanism More...

#include <pthread.h>
#include <unistd.h>

Go to the source code of this file.

Data Structures

struct  pthread_rdwrattr_t
 pthread_rdwr_t attribute structure More...
struct  pthread_rdwr_t
 pthread_rdwr_t structure More...

Defines

#define PTHREAD_RDWR_PREFER_READER   PTHREAD_RDWR_PREFER_READER
 reader preference enumeration
#define PTHREAD_RDWR_PREFER_WRITER   PTHREAD_RDWR_PREFER_WRITER
 writer preference enumeration
#define PTHREAD_RDWR_PREFER_TOGGLE   PTHREAD_RDWR_PREFER_TOGGLE
 toggle preference enumeration
#define PTHREAD_RDWR_PREFER_DEFAULT   PTHREAD_RDWR_PREFER_DEFAULT
 default preference enumeration
#define PTHREAD_RDWR_NORMAL   PTHREAD_RDWR_NORMAL
 normal type enumeration
#define PTHREAD_RDWR_ERRORCHECK   PTHREAD_RDWR_ERRORCHECK
 error checking type enumeration
#define PTHREAD_RDWR_DEFAULT   PTHREAD_RDWR_DEFAULT
 default type enumeration
#define PTHREAD_RDWR_INITIALIZER
 static initializer for pthread_rdwr_t

Enumerations

enum  { PTHREAD_RDWR_PREFER_READER, PTHREAD_RDWR_PREFER_WRITER, PTHREAD_RDWR_PREFER_TOGGLE, PTHREAD_RDWR_PREFER_DEFAULT = PTHREAD_RDWR_PREFER_TOGGLE }
 enumeration for rdwr preference More...
enum  { PTHREAD_RDWR_NORMAL, PTHREAD_RDWR_ERRORCHECK, PTHREAD_RDWR_DEFAULT = PTHREAD_RDWR_NORMAL }
 enumeration for rdwr type More...

Functions

int pthread_rdwr_init (pthread_rdwr_t *rdwr, const pthread_rdwrattr_t *attr)
 initialize pthread_rdwr_t structure
int pthread_rdwr_destroy (pthread_rdwr_t *rdwr)
 initialize pthread_rdwr_t structure
int pthread_rdwr_rdlock (pthread_rdwr_t *rdwr)
 to obtain a read lock
int pthread_rdwr_timedrdlock (pthread_rdwr_t *rdwr, const struct timespec *timeout)
 to try to obtain a read lock for at least timeout duration
int pthread_rdwr_tryrdlock (pthread_rdwr_t *rdwr)
 to obtain a read lock if no write lock
int pthread_rdwr_wrlock (pthread_rdwr_t *rdwr)
 to obtain a write lock
int pthread_rdwr_timedwrlock (pthread_rdwr_t *rdwr, const struct timespec *timeout)
 try to obtain a write lock for at least timeout duration
int pthread_rdwr_trywrlock (pthread_rdwr_t *rdwr)
 try to obtain a write lock if no read lock or write lock
int pthread_rdwr_unlock (pthread_rdwr_t *rdwr)
 unlock current thread
int pthread_rdwrattr_init (pthread_rdwrattr_t *attr)
 initialize pthread_rdwr_t attribute structure
int pthread_rdwrattr_destroy (pthread_rdwrattr_t *attr)
 destroy pthread_rdwr_t attribute structure
int pthread_rdwrattr_getkind (const pthread_rdwrattr_t *attr, int *pref)
 assign kind the current kind attribute
int pthread_rdwrattr_setkind (pthread_rdwrattr_t *attr, const int pref)
 assign current kind attribute
int pthread_rdwrattr_gettype (const pthread_rdwrattr_t *attr, int *type)
 assign type the current type attribute
int pthread_rdwrattr_settype (pthread_rdwrattr_t *attr, const int type)
 assign current type attribute


Detailed Description

functions that provide a read-write locking mechanism

A barrier causes the calling thread to wait until a set number of threads reach a point, then those threads may continue.

Warning:


Define Documentation

#define PTHREAD_RDWR_INITIALIZER

Value:

{ PTHREAD_MUTEX_INITIALIZER, \
        PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, \
        0, 0, 0, 0, 0, PTHREAD_RDWR_PREFER_DEFAULT, PTHREAD_RDWR_DEFAULT }
static initializer for pthread_rdwr_t


Enumeration Type Documentation

anonymous enum

enumeration for rdwr preference

Enumerator:
PTHREAD_RDWR_PREFER_READER  reader preference enumeration
PTHREAD_RDWR_PREFER_WRITER  writer preference enumeration
PTHREAD_RDWR_PREFER_TOGGLE  toggle preference enumeration
PTHREAD_RDWR_PREFER_DEFAULT  default preference enumeration

anonymous enum

enumeration for rdwr type

Enumerator:
PTHREAD_RDWR_NORMAL  normal type enumeration
PTHREAD_RDWR_ERRORCHECK  error checking type enumeration
PTHREAD_RDWR_DEFAULT  default type enumeration


Function Documentation

int pthread_rdwr_destroy ( pthread_rdwr_t rdwr  ) 

initialize pthread_rdwr_t structure

Parameters:
rdwr pointer to pthread_rdwr_t structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwr_init ( pthread_rdwr_t rdwr,
const pthread_rdwrattr_t attr 
)

initialize pthread_rdwr_t structure

Parameters:
rdwr pointer to pthread_rdwr_t structure
attr pointer to pthread_rdwr_t attribute structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwr_rdlock ( pthread_rdwr_t rdwr  ) 

to obtain a read lock

Parameters:
rdwr pointer to pthread_rdwr_t structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwr_timedrdlock ( pthread_rdwr_t rdwr,
const struct timespec *  timeout 
)

to try to obtain a read lock for at least timeout duration

Parameters:
rdwr pointer to pthread_rdwr_t structure
timeout pointer to timespec structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwr_timedwrlock ( pthread_rdwr_t rdwr,
const struct timespec *  timeout 
)

try to obtain a write lock for at least timeout duration

Parameters:
rdwr pointer to pthread_rdwr_t structure
timeout pointer to timespec structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwr_tryrdlock ( pthread_rdwr_t rdwr  ) 

to obtain a read lock if no write lock

Parameters:
rdwr pointer to pthread_rdwr_t structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwr_trywrlock ( pthread_rdwr_t rdwr  ) 

try to obtain a write lock if no read lock or write lock

Parameters:
rdwr pointer to pthread_rdwr_t structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwr_unlock ( pthread_rdwr_t rdwr  ) 

unlock current thread

Parameters:
rdwr pointer to pthread_rdwr_t structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwr_wrlock ( pthread_rdwr_t rdwr  ) 

to obtain a write lock

Parameters:
rdwr pointer to pthread_rdwr_t structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwrattr_destroy ( pthread_rdwrattr_t attr  ) 

destroy pthread_rdwr_t attribute structure

Parameters:
attr pointer to pthread_rdwr_t attribute structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwrattr_getkind ( const pthread_rdwrattr_t attr,
int *  pref 
)

assign kind the current kind attribute

Parameters:
attr pointer to pthread_rdwr_t attribute structure
pref pointer to kind attribute
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwrattr_gettype ( const pthread_rdwrattr_t attr,
int *  type 
)

assign type the current type attribute

Parameters:
attr pointer to pthread_rdwr_t attribute structure
type pointer to type attribute
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwrattr_init ( pthread_rdwrattr_t attr  ) 

initialize pthread_rdwr_t attribute structure

Parameters:
attr pointer to pthread_rdwr_t attribute structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwrattr_setkind ( pthread_rdwrattr_t attr,
const int  pref 
)

assign current kind attribute

Parameters:
attr pointer to pthread_rdwr_t attribute structure
pref kind attribute
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_rdwrattr_settype ( pthread_rdwrattr_t attr,
const int  type 
)

assign current type attribute

Parameters:
attr pointer to pthread_rdwr_t attribute structure
type type attribute
Returns:
0 is returned on success
non-zero error code is returned on failure


Generated on Tue Apr 24 20:01:36 2007 for libctf by  doxygen 1.5.1