mirror of
https://gitlab.com/klmp200/LO41.git
synced 2025-07-11 20:29:24 +00:00
Pthread KILL
This commit is contained in:
@ -122,8 +122,10 @@ void _free__Building(THIS(Building)){
|
||||
DELETE(this->visitors);
|
||||
for (i=0; i<ELEVATOR_NB; i++)
|
||||
DELETE(this->elevators[i]);
|
||||
for (i=0; i<FLOORS; i++)
|
||||
for (i=0; i<FLOORS; i++) {
|
||||
pthread_cond_destroy(this->condition_floors[i]);
|
||||
free(this->condition_floors[i]);
|
||||
}
|
||||
free(this->condition_floors);
|
||||
free(this->mutex_cond_get_inside_elevator);
|
||||
free(this->mutex_cond_get_outside_elevator);
|
||||
@ -156,7 +158,7 @@ void go_to_floor_Building(THIS(Building), int origin, int destination, Passenger
|
||||
int elevator_number;
|
||||
|
||||
if (origin < 0 || origin >= FLOORS) {CRASH("You are trying to start from a non existing floor\n");}
|
||||
if (destination < 0 || origin >= FLOORS) {CRASH("You are trying to reach a non existing floor\n");}
|
||||
if (destination < 0 || destination >= FLOORS) {CRASH("You are trying to reach a non existing floor\n");}
|
||||
|
||||
pthread_cond_wait(this->condition_floors[origin], this->mutex_cond_get_inside_elevator);
|
||||
elevator_number = this->get_inside_elevator(this, origin, passenger, type);
|
||||
|
Reference in New Issue
Block a user