#include #include #include #include #include #include #include #include "logger.hpp" static void* task_1(void* arg) { int i = 0; //for(i = 0; i < 10; i++) { while(1) { std::cout << "Hello, world!" << std::endl; usleep(1000000); } while(1) usleep(10000); }; static void* task_2(void* arg) { while(1) { std::cout << "Task 2"<< std::endl; usleep(10000000); } }; int main(void) { pthread_t th_task_1; pthread_t th_task_2; int check = 0; Logger logger; check = pthread_create(&th_task_1, NULL, &task_1, NULL); if(check != 0) { std::cout << "Failed to create thread!" << std::endl; exit(-1); } check = pthread_create(&th_task_2, NULL, &task_2, NULL); if(check != 0) { std::cout << "Failed to create thread!" << std::endl; exit(-1); } pthread_join(th_task_1,NULL); pthread_join(th_task_2,NULL); pthread_join(logger.get_handle()); return 0; }