#include "net_mod_server_socket_wrapper.h" #include "net_mod_socket_wrapper.h" #include "bus_server_socket_wrapper.h" #include "shm_mm_wraper.h" #include "usg_common.h" #include static void * server_sockt; static void *_start_bus_(void *arg) { // pthread_detach(pthread_self()); printf("Start bus server\n"); pthread_t tid; server_sockt = bus_server_socket_wrapper_open(); if(bus_server_socket_wrapper_start_bus(server_sockt) != 0) { printf("start bus failed\n"); } } int main() { pthread_t tid; char action[512]; shm_mm_wrapper_init(512); pthread_create(&tid, NULL, _start_bus_, NULL); while (true) { printf("Input action: Close?\n"); if(scanf("%s", action) < 1) { printf("Invalide action\n"); continue; } if(strcmp(action, "close") == 0) { bus_server_socket_wrapper_close(server_sockt); break; } else { printf("Invalide action\n"); } } if (pthread_join(tid, NULL) != 0) { perror(" pthread_join"); } shm_mm_wrapper_destroy(); }