1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2025-07-21 09:09:44 +00:00

Voilà comment gérer ses threads comme un boss

This commit is contained in:
2018-06-22 02:50:04 +02:00
parent cf27667313
commit e2beb598a9
10 changed files with 80 additions and 29 deletions

View File

@ -42,6 +42,13 @@ void *runnable_Passenger(void * void_this){
return NULL;
}
void set_thread_number_Passenger(THIS(Passenger), int thread_number){
if (this->type == RESIDENT)
this->resident->set_thread_number(this->resident, thread_number);
if (this->type == VISITOR)
this->visitor->set_thread_number(this->visitor, thread_number);
}
void _free__Passenger(THIS(Passenger)){
free(this);
}

View File

@ -23,6 +23,7 @@ typedef struct o_Passenger {
PUBLIC int (*get_destination)(_THIS(Passenger));
PUBLIC void * (*runnable)(void* void_this);
PUBLIC int (*compare)(void * passenger1, void * passenger2);//yeah I know, but i needed int (*) (void*, void*)
PUBLIC void (*set_thread_number)(_THIS(Passenger), int thread_number);
DESTRUCTOR(Passenger);
} Passenger;