1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2025-07-11 12:19:25 +00:00

Merci klipfel pour l'astuce

This commit is contained in:
2018-06-18 16:09:28 +02:00
parent e820bd7a58
commit ba921acbf3
6 changed files with 28 additions and 32 deletions

View File

@ -28,11 +28,11 @@ void _free__Elevator(THIS(Elevator)){
free(this);
}
void add_passenger_Elevator(THIS(Elevator), ElevatorPassenger passenger){
void add_passenger_Elevator(THIS(Elevator), Passenger passenger){
pthread_mutex_lock(&this->mutex_passenger);
this->passengers->insert_tail(this->passengers, ((void *)&passenger), sizeof(ElevatorPassenger));
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.passenger.visitor->get_id(passenger.passenger.visitor), this->name, this->passengers->get_size(this->passengers), this->name);
passenger.visitor->get_id(passenger.visitor), this->name, 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);

View File

@ -31,7 +31,7 @@ typedef struct o_Elevator {
SYNCHRONIZE PUBLIC void (*repair)(_THIS(Elevator));
SYNCHRONIZE PUBLIC int (*get_number_of_passengers)(_THIS(Elevator));
SYNCHRONIZE PUBLIC void (*add_passenger)(_THIS(Elevator), ElevatorPassenger passenger);
SYNCHRONIZE PUBLIC void (*add_passenger)(_THIS(Elevator), Passenger passenger);
SYNCHRONIZE PUBLIC ELEVATOR_STATE (*get_state)(_THIS(Elevator));
SYNCHRONIZE PUBLIC int (*get_floor)(_THIS(Elevator));
SYNCHRONIZE PUBLIC int (*can_get_inside)(_THIS(Elevator), int floor);