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:
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user