1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2025-07-12 04:39:23 +00:00

Added remove_inside_List function. Experimental user removal.

This commit is contained in:
Aethor
2018-06-21 19:21:17 +02:00
parent 12c4e1af19
commit 55126c9ca6
3 changed files with 55 additions and 16 deletions

View File

@ -40,6 +40,12 @@ void add_passenger_Elevator(THIS(Elevator), Passenger * passenger){
pthread_mutex_unlock(&this->mutex_passengers);
}
void remove_passenger_Elevator(THIS(Elevator), Passenger * passenger){
pthread_mutex_lock(&this->mutex_passengers);
this->passengers->remove_inside(this->passengers, passenger, passenger->compare);
pthread_mutex_unlock(&this->mutex_passengers);
}
int get_number_of_passengers_Elevator(THIS(Elevator)){
int num;
pthread_mutex_lock(&this->mutex_passengers);
@ -127,6 +133,7 @@ void *runnable_Elevator(void * void_this){
printf("DEBUG : Next passenger stop : %d\n", next_passenger_stop);
printf("DEBUG : Next call from user : %d\n", next_call);
printf("\n\n");
fflush(stdout);
}
this->set_floor(this, this->target_floor);
}