| | |
| | | LDFLAGS= |
| | | |
| | | |
| | | CFLAGS = $(INCLUDE) -I. -I./include -I$(ROOT)/common -std=c++11 -mcx16 -Wall -DLINUX -D_GNU_SOURCE $(EXTRA) |
| | | CFLAGS = $(INCLUDE) -I. -I./include -I$(ROOT)/common -I$(ROOT)/common/include -g -std=c++11 -mcx16 -Wall -DLINUX -D_GNU_SOURCE $(EXTRA) |
| | | |
| | | ifeq ($(pic),y) |
| | | CFLAGS += -fPIC |
| | |
| | | while (!mterminate.load()) { |
| | | std::this_thread::sleep_for(std::chrono::seconds(this->keepTime * 2)); |
| | | //sleep(this->keepTime); |
| | | for(iter = statusMap.begin(); iter != statusMap.end(); iter++) { |
| | | for(iter = statusMap.begin(); iter != statusMap.end();) { |
| | | |
| | | status = iter->second; |
| | | if (status != nullptr) { |
| | |
| | | if(difftime(time(NULL), status->lastTime) > this->keepTime*2) { |
| | | std::cout << status->id << "脱离监控区, remove from map\n"; |
| | | delete status; |
| | | statusMap.erase(iter); |
| | | |
| | | iter = statusMap.erase(iter); |
| | | continue; |
| | | } |
| | | } |
| | | iter++; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | void test3() { |
| | | |
| | | std::ifstream fin("test2.txt"); |
| | | std::ifstream fin("test3.txt"); |
| | | char line[1024]; |
| | | //std::string line; |
| | | char *targetIdStr; |