1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2025-07-10 19:59:24 +00:00

Bip, je suis l'interphone

This commit is contained in:
2018-06-11 10:52:58 +02:00
parent e52cb25c55
commit ce0e2ca931
9 changed files with 21 additions and 51 deletions

View File

@ -5,12 +5,7 @@
#include "SharedData.h"
GETTER(SharedData, Building *, main_building)
GETTER(SharedData, CommunicationBox *, box)
void set_main_building_SharedData(THIS(SharedData), Building * building){
this->main_building = building;
this->box = (building != NULL ) ? building->box : NULL;
}
SETTER(SharedData, Building *, main_building)
void wait_threads_SharedData(THIS(SharedData)){
int i;
@ -97,8 +92,7 @@ SharedData *_get_instance_SharedData(){
new_shared_data = malloc_or_die(sizeof(SharedData));
new_shared_data->threads = NULL;
new_shared_data->main_building = NULL; /* Should be set to NULL if freed */
new_shared_data->box = NULL; /* freed inside main_building */
new_shared_data->main_building = NULL; /* Should be set to NULL if freed before */
new_shared_data->threads_nb = 0;
LINK_ALL(SharedData, new_shared_data,
@ -108,7 +102,6 @@ SharedData *_get_instance_SharedData(){
wait_all_threads,
set_main_building,
get_main_building,
get_box,
call_elevator
);
}

View File

@ -19,7 +19,6 @@ typedef struct o_SharedData {
PRIVATE pthread_mutex_t mutex_array[MUTEX_NB];
PRIVATE Building * main_building;
PRIVATE CommunicationBox * box;
PRIVATE void (*start_thread)(_THIS(SharedData), void * (*thread)(void *), void * data, int thread_number);
@ -27,7 +26,6 @@ typedef struct o_SharedData {
PUBLIC void (*start_all_threads)(_THIS(SharedData));
PUBLIC void (*set_main_building)(_THIS(SharedData), Building * building);
PUBLIC Building * (*get_main_building)(_THIS(SharedData));
PUBLIC CommunicationBox * (*get_box)(_THIS(SharedData));
PUBLIC void (*wait_threads)(_THIS(SharedData));
PUBLIC int (*call_elevator)(_THIS(SharedData), int starting_floor, int destination_floor);