mirror of
https://gitlab.com/klmp200/LO41.git
synced 2024-11-25 02:24:23 +00:00
Les doublons
This commit is contained in:
parent
3126e57610
commit
8bf2b3358d
@ -7,12 +7,6 @@
|
|||||||
GETTER(SharedData, Building *, main_building)
|
GETTER(SharedData, Building *, main_building)
|
||||||
SETTER(SharedData, Building *, main_building)
|
SETTER(SharedData, Building *, main_building)
|
||||||
|
|
||||||
void wait_threads_SharedData(THIS(SharedData)){
|
|
||||||
int i;
|
|
||||||
for (i=0; i<this->threads_nb; i++)
|
|
||||||
pthread_join(this->threads[i], NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
int call_elevator_SharedData(THIS(SharedData), int starting_floor, int destination_floor){
|
int call_elevator_SharedData(THIS(SharedData), int starting_floor, int destination_floor){
|
||||||
/* Make the thread wait for an elevator available and return the id of the elevator available */
|
/* Make the thread wait for an elevator available and return the id of the elevator available */
|
||||||
if (this->main_building == NULL)
|
if (this->main_building == NULL)
|
||||||
@ -103,7 +97,6 @@ SharedData *_get_instance_SharedData(){
|
|||||||
new_shared_data->threads_nb = 0;
|
new_shared_data->threads_nb = 0;
|
||||||
|
|
||||||
LINK_ALL(SharedData, new_shared_data,
|
LINK_ALL(SharedData, new_shared_data,
|
||||||
wait_threads,
|
|
||||||
start_thread,
|
start_thread,
|
||||||
start_all_threads,
|
start_all_threads,
|
||||||
wait_all_threads,
|
wait_all_threads,
|
||||||
|
@ -20,7 +20,6 @@ typedef struct o_SharedData {
|
|||||||
PUBLIC void (*start_all_threads)(_THIS(SharedData));
|
PUBLIC void (*start_all_threads)(_THIS(SharedData));
|
||||||
PUBLIC void (*set_main_building)(_THIS(SharedData), Building * building);
|
PUBLIC void (*set_main_building)(_THIS(SharedData), Building * building);
|
||||||
PUBLIC Building * (*get_main_building)(_THIS(SharedData));
|
PUBLIC Building * (*get_main_building)(_THIS(SharedData));
|
||||||
PUBLIC void (*wait_threads)(_THIS(SharedData));
|
|
||||||
PUBLIC int (*call_elevator)(_THIS(SharedData), int starting_floor, int destination_floor);
|
PUBLIC int (*call_elevator)(_THIS(SharedData), int starting_floor, int destination_floor);
|
||||||
PUBLIC int (*use_call_box)(_THIS(SharedData), char * resident_name);
|
PUBLIC int (*use_call_box)(_THIS(SharedData), char * resident_name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user