| | |
| | | #include "usg_common.h" |
| | | #include "mm.h" |
| | | #include "logger_factory.h" |
| | | |
| | | #include "bus_error.h" |
| | | |
| | | static Logger *logger = LoggerFactory::getLogger(); |
| | | |
| | | |
| | | BusServerSocket * server_socket; |
| | | void sigint_handler(int sig) { |
| | | |
| | |
| | | void *recvbuf; |
| | | int size; |
| | | int key; |
| | | |
| | | int rv; |
| | | ShmModSocket *sk = (ShmModSocket *)skptr; |
| | | printf("run_recv\n"); |
| | | struct timespec timeout = {2, 0}; |
| | | while (true) { |
| | | printf("run_recv before\n"); |
| | |
| | | |
| | | } |
| | | |
| | | void *run_recv2(void *skptr) { |
| | | pthread_detach(pthread_self()); |
| | | while(true) { |
| | | logger->debug("================run_recv\n"); |
| | | // sleep(1); |
| | | } |
| | | } |
| | | |
| | | void client2(int key) { |
| | | ShmModSocket *sk = new ShmModSocket(); |
| | | run_recv((void *)sk); |
| | | } |
| | | |
| | | void client(int key) { |
| | | ShmModSocket *sk = new ShmModSocket(); |
| | | |
| | | pthread_t tid; |
| | | |
| | | |
| | | int size; |
| | | |
| | |
| | | while (true) { |
| | | //printf("Usage: pub <topic> [content] or sub <topic>\n"); |
| | | printf("Can I help you? sub, pub, desub or quit %d\n", i++); |
| | | printf("client 1\n"); |
| | | // scanf("%s", action); |
| | | std::cin >> action; |
| | | printf("client 2\n"); |
| | | if(strcmp(action, "sub") == 0) { |
| | | printf("Please input topic!\n"); |
| | | scanf("%s", topic); |
| | |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | } |