Skip to content
Snippets Groups Projects
Commit 2512bc25 authored by Alexandru BRĂSLAŞU's avatar Alexandru BRĂSLAŞU
Browse files

Tema

parent d1fb47c9
No related branches found
No related tags found
No related merge requests found
Pipeline #44215 passed
......@@ -41,7 +41,7 @@ void enqueue_task(os_threadpool_t *tp, os_task_t *t)
/* TODO: Enqueue task to the shared task queue. Use synchronization. */
pthread_mutex_lock(&tp->mutexCoada);
list_add_tail(&tp->head, &t->list);
pthread_cond_signal(&tp->Wait);
pthread_cond_broadcast(&tp->Wait);
pthread_mutex_unlock(&tp->mutexCoada);
}
......@@ -114,7 +114,7 @@ void wait_for_completion(os_threadpool_t *tp)
pthread_cond_wait(&tp->WakeUp, &tp->mutexCoada);
tp->stop = 1;
while (tp->threadsOut < tp->num_threads) {
pthread_cond_signal(&tp->Wait);
pthread_cond_broadcast(&tp->Wait);
pthread_cond_wait(&tp->WakeUp, &tp->mutexCoada);
}
/* Join all worker threads. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment