This shows you the differences between two versions of the page.
|
app:laboratoare:04 [2025/11/12 05:00] alexandru.bala [Barieră] |
app:laboratoare:04 [2025/11/12 05:03] (current) alexandru.bala [Variabile condiție] |
||
|---|---|---|---|
| Line 194: | Line 194: | ||
| int arguments[NUM_THREADS]; | int arguments[NUM_THREADS]; | ||
| - | // cream mutex-ul | + | // creăm mutex-ul |
| pthread_mutex_init(&mutex, NULL); | pthread_mutex_init(&mutex, NULL); | ||
| Line 360: | Line 360: | ||
| pthread_mutex_init (&mutex, NULL); | pthread_mutex_init (&mutex, NULL); | ||
| - | |||
| sem_init (&full_sem, 0, 0); | sem_init (&full_sem, 0, 0); | ||
| sem_init (&empty_sem, 0, 3); | sem_init (&empty_sem, 0, 3); | ||
| Line 380: | Line 379: | ||
| sem_destroy (&empty_sem); | sem_destroy (&empty_sem); | ||
| sem_destroy (&full_sem); | sem_destroy (&full_sem); | ||
| - | |||
| pthread_mutex_destroy (&mutex); | pthread_mutex_destroy (&mutex); | ||
| Line 495: | Line 493: | ||
| } | } | ||
| + | pthread_cond_destroy (&empty_cond, NULL); | ||
| + | pthread_cond_destroy (&full_cond, NULL); | ||
| pthread_mutex_destroy(&mutex); | pthread_mutex_destroy(&mutex); | ||