标签:blog os ar 2014 art div sp 代码 log
例如以下一段代码能够借鉴:
static void _sleep_response_timeout(modbus_t *ctx) { #ifdef _WIN32 /* usleep doesn‘t exist on Windows */ Sleep((ctx->response_timeout.tv_sec * 1000) + (ctx->response_timeout.tv_usec / 1000)); #else /* usleep source code */ struct timespec request, remaining; request.tv_sec = ctx->response_timeout.tv_sec; request.tv_nsec = ((long int)ctx->response_timeout.tv_usec % 1000000) * 1000; while (nanosleep(&request, &remaining) == -1 && errno == EINTR) request = remaining; #endif }
标签:blog os ar 2014 art div sp 代码 log
原文地址:http://www.cnblogs.com/hrhguanli/p/3960287.html