Fix issue #2, check posix return values
Former-commit-id: 01a529cbda919d5514a4a445b26a0408115173ca
This commit is contained in:
parent
5ee7a6b8f1
commit
fbf4e190ce
@ -101,9 +101,9 @@ void bioInit(void) {
|
|||||||
|
|
||||||
/* Initialization of state vars and objects */
|
/* Initialization of state vars and objects */
|
||||||
for (j = 0; j < BIO_NUM_OPS; j++) {
|
for (j = 0; j < BIO_NUM_OPS; j++) {
|
||||||
pthread_mutex_init(&bio_mutex[j],NULL);
|
serverAssert(pthread_mutex_init(&bio_mutex[j],NULL) == 0);
|
||||||
pthread_cond_init(&bio_newjob_cond[j],NULL);
|
serverAssert(pthread_cond_init(&bio_newjob_cond[j],NULL) == 0);
|
||||||
pthread_cond_init(&bio_step_cond[j],NULL);
|
serverAssert(pthread_cond_init(&bio_step_cond[j],NULL) == 0);
|
||||||
bio_jobs[j] = listCreate();
|
bio_jobs[j] = listCreate();
|
||||||
bio_pending[j] = 0;
|
bio_pending[j] = 0;
|
||||||
}
|
}
|
||||||
|
@ -1534,13 +1534,19 @@ int main(int argc, const char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config.num_threads > 0) {
|
if (config.num_threads > 0) {
|
||||||
pthread_mutex_init(&(config.requests_issued_mutex), NULL);
|
int err = 0;
|
||||||
pthread_mutex_init(&(config.requests_finished_mutex), NULL);
|
err |= pthread_mutex_init(&(config.requests_issued_mutex), NULL);
|
||||||
pthread_mutex_init(&(config.liveclients_mutex), NULL);
|
err |= pthread_mutex_init(&(config.requests_finished_mutex), NULL);
|
||||||
pthread_mutex_init(&(config.is_fetching_slots_mutex), NULL);
|
err |= pthread_mutex_init(&(config.liveclients_mutex), NULL);
|
||||||
pthread_mutex_init(&(config.is_updating_slots_mutex), NULL);
|
err |= pthread_mutex_init(&(config.is_fetching_slots_mutex), NULL);
|
||||||
pthread_mutex_init(&(config.updating_slots_mutex), NULL);
|
err |= pthread_mutex_init(&(config.is_updating_slots_mutex), NULL);
|
||||||
pthread_mutex_init(&(config.slots_last_update_mutex), NULL);
|
err |= pthread_mutex_init(&(config.updating_slots_mutex), NULL);
|
||||||
|
err |= pthread_mutex_init(&(config.slots_last_update_mutex), NULL);
|
||||||
|
if (err != 0)
|
||||||
|
{
|
||||||
|
perror("Failed to initialize mutex");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.keepalive == 0) {
|
if (config.keepalive == 0) {
|
||||||
|
@ -2250,9 +2250,9 @@ void createSharedObjects(void) {
|
|||||||
void initServerConfig(void) {
|
void initServerConfig(void) {
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
pthread_mutex_init(&server.next_client_id_mutex,NULL);
|
serverAssert(pthread_mutex_init(&server.next_client_id_mutex,NULL) == 0);
|
||||||
pthread_mutex_init(&server.lruclock_mutex,NULL);
|
serverAssert(pthread_mutex_init(&server.lruclock_mutex,NULL) == 0);
|
||||||
pthread_mutex_init(&server.unixtime_mutex,NULL);
|
serverAssert(pthread_mutex_init(&server.unixtime_mutex,NULL) == 0);
|
||||||
|
|
||||||
updateCachedTime();
|
updateCachedTime();
|
||||||
getRandomHexChars(server.runid,CONFIG_RUN_ID_SIZE);
|
getRandomHexChars(server.runid,CONFIG_RUN_ID_SIZE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user