2018-06-04 22:26:48 +00:00
|
|
|
#include <stdio.h>
|
2018-06-07 20:04:30 +00:00
|
|
|
#include <signal.h>
|
2018-06-10 02:00:01 +00:00
|
|
|
#include <unistd.h>
|
2018-06-07 20:04:30 +00:00
|
|
|
|
2018-06-04 22:26:48 +00:00
|
|
|
#include "Objects.h"
|
|
|
|
#include "List/List.h"
|
2018-06-06 01:00:35 +00:00
|
|
|
#include "Building/Building.h"
|
2018-06-06 11:50:11 +00:00
|
|
|
#include "SharedData/SharedData.h"
|
2018-06-06 18:29:02 +00:00
|
|
|
#include "Visitor/Visitor.h"
|
|
|
|
#include "Resident/Resident.h"
|
2018-06-04 22:26:48 +00:00
|
|
|
|
2018-06-07 20:04:30 +00:00
|
|
|
void clean_exit(int error_code){
|
2018-06-07 20:35:20 +00:00
|
|
|
printf("Signal %d received, exiting app\n", error_code);
|
2018-06-07 20:04:30 +00:00
|
|
|
DELETE(GET_INSTANCE(SharedData));
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2018-06-04 22:26:48 +00:00
|
|
|
int main() {
|
2018-06-10 23:58:52 +00:00
|
|
|
SharedData * shared_data = GET_INSTANCE(SharedData);
|
2018-06-10 02:00:01 +00:00
|
|
|
|
2018-06-10 23:58:52 +00:00
|
|
|
shared_data->set_main_building(shared_data, NEW(Building, "../residents.txt", "../visitors.txt"));
|
|
|
|
shared_data->start_all_threads(shared_data);
|
|
|
|
shared_data->wait_all_threads(shared_data);
|
|
|
|
DELETE(shared_data);
|
2018-06-10 02:00:01 +00:00
|
|
|
|
2018-06-04 22:26:48 +00:00
|
|
|
return 0;
|
|
|
|
}
|