1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2025-07-11 20:29:24 +00:00

BEHOLD ! The threadinator !

This commit is contained in:
2018-06-11 01:58:52 +02:00
parent bd5860579e
commit fd2463904a
10 changed files with 110 additions and 78 deletions

View File

@ -9,6 +9,13 @@ GETTER(Resident, char *, name);
GETTER(Resident, int, id);
GETTER(Resident, int, apartment_floor);
void * runnable_Resident(void * void_this){
Resident * this = (Resident*) void_this;
printf("Je suis le resident %s et je suis a l'etage %d en direction de l'etage %d\n",
this->name, this->apartment_floor, this->destination);
return NULL;
}
void _free__Resident(THIS(Resident)){
if (this->name != NULL)
free(this->name);
@ -27,6 +34,7 @@ Resident *_init_Resident(int id, char* name, int apartment_floor, int destinatio
LINK_ALL(Resident, new_resident,
get_name,
get_id,
runnable,
get_apartment_floor
)

View File

@ -14,6 +14,7 @@ typedef struct o_Resident {
PRIVATE int position;
PRIVATE char* name;
PUBLIC void * (*runnable)(void * void_this);
PUBLIC char * (*get_name)(_THIS(Resident));
PUBLIC int (*get_id)(_THIS(Resident));
PUBLIC int (*get_apartment_floor)(_THIS(Resident));