mirror of
https://gitlab.com/klmp200/LO41.git
synced 2024-11-21 16:23:22 +00:00
Toujours un peu de refactoring
This commit is contained in:
parent
ba921acbf3
commit
1fb5817935
@ -31,8 +31,9 @@ void _free__Elevator(THIS(Elevator)){
|
||||
void add_passenger_Elevator(THIS(Elevator), Passenger passenger){
|
||||
pthread_mutex_lock(&this->mutex_passenger);
|
||||
this->passengers->insert_tail(this->passengers, ((void *)&passenger), sizeof(Passenger));
|
||||
printf("Le passager avec l'id %d est entre dans l'ascenseur %s\nIl y a maintenant %d passagers dans l'ascenseur %s\n",
|
||||
passenger.visitor->get_id(passenger.visitor), this->name, this->passengers->get_size(this->passengers), this->name);
|
||||
printf("L'ascenseur %s recoit le visiteur %s\nIl y a maintenant %d passagers dans l'ascenseur %s\n", this->name,
|
||||
passenger.type == VISITOR ? passenger.visitor->get_name(passenger.visitor) : passenger.resident->get_name(passenger.resident),
|
||||
this->passengers->get_size(this->passengers), this->name);
|
||||
if (this->passengers->get_size(this->passengers) >= MAX_ELEVATOR_CAPACITY)
|
||||
this->set_state(this, SLEEPING);
|
||||
pthread_mutex_unlock(&this->mutex_passenger);
|
||||
|
Loading…
Reference in New Issue
Block a user