OSF DCE Application Development Guide--Core Components
Topics in RPC Application Development
/* The server entry name: */
extern unsigned_char_p_t entry;
/* Initialization control block: */
pthread_once_t init_once_blk = pthread_once_init;
/******
*
* store_mgmt_init -- Zeroes out all the storelet structures; executed
* only once per server instance, as soon as a client
* has called the store_open() routine.
*
******/
/************************************************************************/
void
store_mgmt_init(
)
{
int i;
store_hdr_t *hdr;
fprintf(stdout, "Store Manager: Initializing Store0);
memset(headers, 0, sizeof(store_hdr_t) * NUM_STORELETS);
for (i = 0; i < NUM_STORELETS; i++)
{
hdr = headers + i;
pthread_mutex_init(
(pthread_mutex_t *)hdr,
pthread_mutexattr_default);
}
}
/******
*
* store_open -- Opens a store and returns a handle to it. Store consists
* of one "storelet" selected from array of NUM_STORELETS.
*
******/
/************************************************************************/
void
store_open(
handle_t binding,
unsigned32 store_size, /* Size specified for actual storage. */
store_handle_t *store_h, /* To return the store handle in. */
error_status_t *status
)
{
int i; /* Index variable. */
store_spec_t *spec; /* Store specification == handle. */
store_hdr_t *hdr; /* Storelet structure. */
/* Do the store initialization if this is the first open call... */
/* Zero out the store headers... */
124245 Tandem Computers Incorporated 16− 15