Skip to content

Commit

Permalink
Fixed rename of init pthread functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Dec 4, 2022
1 parent 85c9bb9 commit 4295891
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions event_pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ void *event_create(void) {
event_s *event = (event_s *)calloc(1, sizeof(event_s));
if (!event)
return NULL;
if (pthread_cond_global_init(&event->cond, NULL)) {
if (pthread_cond_init(&event->cond, NULL)) {
free(event);
return NULL;
}
if (pthread_mutex_global_init(&event->mutex, NULL)) {
if (pthread_mutex_init(&event->mutex, NULL)) {
pthread_cond_destroy(&event->cond);
free(event);
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion mutex_pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void *mutex_create(void) {
mutex_s *mutex = (mutex_s *)calloc(1, sizeof(mutex_s));
if (!mutex)
return NULL;
if (pthread_mutex_global_init(&mutex->handle, NULL)) {
if (pthread_mutex_init(&mutex->handle, NULL)) {
free(mutex);
return NULL;
}
Expand Down
6 changes: 3 additions & 3 deletions threadpool_pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ void *threadpool_create(int32_t min_threads, int32_t max_threads) {
threadpool->min_threads = min_threads;
threadpool->max_threads = max_threads;

pthread_mutex_global_init(&threadpool->queue_mutex, NULL);
pthread_cond_global_init(&threadpool->wakeup_cond, NULL);
pthread_cond_global_init(&threadpool->lazy_cond, NULL);
pthread_mutex_init(&threadpool->queue_mutex, NULL);
pthread_cond_init(&threadpool->wakeup_cond, NULL);
pthread_cond_init(&threadpool->lazy_cond, NULL);

return threadpool;
}
Expand Down

0 comments on commit 4295891

Please sign in to comment.