From 8e7d65176805fbc327ffa74a56fc0bbda68f85da Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 25 Jul 2022 18:37:29 +0800 Subject: [PATCH] fix: add delay to udf1 --- source/libs/function/test/udf1.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/source/libs/function/test/udf1.c b/source/libs/function/test/udf1.c index b53f82c3e9..5be18af553 100644 --- a/source/libs/function/test/udf1.c +++ b/source/libs/function/test/udf1.c @@ -1,8 +1,12 @@ #include #include #include +#ifdef LINUX #include - +#endif +#ifdef WINDOWS +#include +#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; } \ No newline at end of file