fix: add delay to udf1
This commit is contained in:
parent
43eefef68c
commit
8e7d651768
|
@ -1,8 +1,12 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifdef LINUX
|
||||
#include <unistd.h>
|
||||
|
||||
#endif
|
||||
#ifdef WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "taosudf.h"
|
||||
|
||||
|
||||
|
@ -37,17 +41,11 @@ DLL_EXPORT int32_t udf1(SUdfDataBlock* block, SUdfColumn *resultCol) {
|
|||
}
|
||||
}
|
||||
//to simulate actual processing delay by udf
|
||||
#ifdef LINUX
|
||||
usleep(1 * 1000); // usleep takes sleep time in us (1 millionth of a second)
|
||||
#endif
|
||||
#ifdef WINDOWS
|
||||
HANDLE timer;
|
||||
LARGE_INTEGER interval;
|
||||
interval.QuadPart = (10 * 1000);
|
||||
|
||||
timer = CreateWaitableTimer(NULL, TRUE, NULL);
|
||||
SetWaitableTimer(timer, &interval, 0, NULL, NULL, 0);
|
||||
WaitForSingleObject(timer, INFINITE);
|
||||
CloseHandle(timer);
|
||||
#else
|
||||
usleep(1000);
|
||||
Sleep(1);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue