RW_ALLOC(D3)RW_ALLOC(D3)NAME
RW_ALLOC, RW_INIT - reader/writer lock initialization
SYNOPSIS
#include <sys/types.h>
#include <sys/kmem.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
sleep_t *RW_ALLOC(char *name, int flag);
void RW_INIT(rwlock_t *lockp, char *name);
Arguments
lockp Pointer to uninitialized reader/writer lock.
name Name applied to reader/writer lock when metering locks are
installed.
flag Specifies whether the caller is willing to sleep waiting for
memory.
DESCRIPTION
RW_ALLOC dynamically allocates and initializes an instance of a
reader/writer lock. RW_INIT initializes an instance of a reader/writer
lock. The lock is initialized to the unlocked state.
If flag is set to KM_SLEEP, the caller will sleep if necessary until
sufficient memory is available. If flag is set to KM_NOSLEEP, the caller
will not sleep, but RW_ALLOC will return NULL if sufficient memory is not
immediately available.
Return Values
Upon successful completion, RW_ALLOC returns a pointer to the newly
allocated lock. If KM_NOSLEEP is specified and sufficient memory is not
immediately available, RW_ALLOC returns a NULL pointer.
USAGE
Level
Base or Initialization.
Synchronization Constraints
May sleep if flag is set to KM_SLEEP.
Driver-defined basic locks and sleeping locks may be held across calls to
this function if flag is KM_NOSLEEP but may not be held if flag is
KM_SLEEP.
Driver-defined sleeping locks may be held across calls to this function
regardless of the value of flag.
Page 1
RW_ALLOC(D3)RW_ALLOC(D3)REFERENCESRW_DEALLOC(D3), RW_DESTROY(D3), RW_RDLOCK(D3), RW_WRLOCK(D3),
RW_TRYRDLOCK(D3), RW_TRYWRLOCK(D3), RW_UNLOCK(D3)
Page 2