Merge pull request #9 from Globostofo/patch-semantic

Added more semantic by using binary semaphores
This commit is contained in:
Romain CLEMENT 2023-10-17 20:57:36 +02:00 committed by GitHub
commit a60331d0be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,10 +14,10 @@ mutex cout_mutex;
// GLOBAL VARIABLES // GLOBAL VARIABLES
int carsWaiting = 0; int carsWaiting = 0;
mutex mutexCar; mutex mutexCar;
counting_semaphore carArrived(0); binary_semaphore carArrived(0);
counting_semaphore bayFree(0); binary_semaphore bayFree(0);
counting_semaphore carWashed(0); binary_semaphore carWashed(0);
counting_semaphore washingDone(0); binary_semaphore washingDone(0);
void car(size_t id) void car(size_t id)
{ {