Exemplo n.º 1
0
static void *
_timer(void *p) {
	struct monitor * m = p;
	skynet_initthread(THREAD_TIMER);
	for (;;) {
		skynet_updatetime();
		CHECK_ABORT
		wakeup(m,m->count-1);
		//usleep(2500);
		Sleep(2);
	}
	// wakeup socket thread
	skynet_socket_exit();
	// wakeup all worker thread
	pthread_cond_broadcast(&m->cond);
	return NULL;
}
Exemplo n.º 2
0
// 定时器线程
static void _timer(void *p)
{
	monitor *m = (monitor *)p;
	SNServer::Get()->ThreadInit(THREAD_TIMER);
	for (;;) {
		skynet_updatetime();
		CHECK_ABORT;
		wakeup(m, m->count - 1);
		std::this_thread::sleep_for((std::chrono::milliseconds(10)));
	}

	// TODO :: 这里要退出SOCKET线程
	// wakeup socket thread
	skynet_socket_exit();

	// wakeup all worker thread
	m->cond.notify_all();
}