use select for sleep instead of nanosleep for portability reasons

    added make of mgmapi_logevent_example
parent e33633c1
...@@ -4,7 +4,8 @@ BIN_DIRS := ndbapi_simple_example \ ...@@ -4,7 +4,8 @@ BIN_DIRS := ndbapi_simple_example \
ndbapi_retries_example \ ndbapi_retries_example \
ndbapi_simple_index_example \ ndbapi_simple_index_example \
ndbapi_event_example \ ndbapi_event_example \
ndbapi_scan_example ndbapi_scan_example \
mgmapi_logevent_example
bins: $(patsubst %, _bins_%, $(BIN_DIRS)) bins: $(patsubst %, _bins_%, $(BIN_DIRS))
......
...@@ -57,16 +57,15 @@ ...@@ -57,16 +57,15 @@
/** /**
* Helper sleep function * Helper sleep function
*/ */
int static void
milliSleep(int milliseconds){ milliSleep(int milliseconds){
int result = 0; struct timeval sleeptime;
struct timespec sleeptime;
sleeptime.tv_sec = milliseconds / 1000; sleeptime.tv_sec = milliseconds / 1000;
sleeptime.tv_nsec = (milliseconds - (sleeptime.tv_sec * 1000)) * 1000000; sleeptime.tv_usec = (milliseconds - (sleeptime.tv_sec * 1000)) * 1000000;
result = nanosleep(&sleeptime, NULL); select(0, 0, 0, 0, &sleeptime);
return result;
} }
/** /**
* error printout macro * error printout macro
*/ */
......
...@@ -72,18 +72,17 @@ ...@@ -72,18 +72,17 @@
#include <NdbApi.hpp> #include <NdbApi.hpp>
// Used for cout // Used for cout
#include <iostream> #include <iostream>
#include <stdio.h>
/** /**
* Helper sleep function * Helper sleep function
*/ */
int static void
milliSleep(int milliseconds){ milliSleep(int milliseconds){
int result = 0; struct timeval sleeptime;
struct timespec sleeptime;
sleeptime.tv_sec = milliseconds / 1000; sleeptime.tv_sec = milliseconds / 1000;
sleeptime.tv_nsec = (milliseconds - (sleeptime.tv_sec * 1000)) * 1000000; sleeptime.tv_usec = (milliseconds - (sleeptime.tv_sec * 1000)) * 1000000;
result = nanosleep(&sleeptime, NULL); select(0, 0, 0, 0, &sleeptime);
return result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment