1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2024-11-14 12:53:22 +00:00
LO41/SharedData/SharedData.h

32 lines
929 B
C
Raw Normal View History

2018-06-06 11:50:11 +00:00
//
// Created by Antoine Bartuccio on 06/06/2018.
//
#ifndef LO41_SHAREDDATA_H
#define LO41_SHAREDDATA_H
#include <pthread.h>
2018-06-06 11:50:11 +00:00
#include "../Objects.h"
#include "../Building/Building.h"
2018-06-06 11:50:11 +00:00
typedef struct o_SharedData {
PRIVATE int threads_nb;
PRIVATE pthread_t *threads;
PRIVATE Building * main_building;
2018-06-10 23:58:52 +00:00
PRIVATE void (*start_thread)(_THIS(SharedData), void * (*thread)(void *), void * data, int thread_number);
PUBLIC void (*wait_all_threads)(_THIS(SharedData));
PUBLIC void (*start_all_threads)(_THIS(SharedData));
PUBLIC void (*set_main_building)(_THIS(SharedData), Building * building);
2018-06-07 22:49:20 +00:00
PUBLIC Building * (*get_main_building)(_THIS(SharedData));
PUBLIC int (*call_elevator)(_THIS(SharedData), int starting_floor, int destination_floor);
PUBLIC int (*use_call_box)(_THIS(SharedData), char * resident_name);
2018-06-06 11:50:11 +00:00
DESTRUCTOR(SharedData);
} SharedData;
SharedData *_get_instance_SharedData();
#endif //LO41_SHAREDDATA_H