From ba81feaa86f80cbaaaef3fdea1ffe07341725154 Mon Sep 17 00:00:00 2001 From: H-ZeX Date: Fri, 9 Aug 2019 00:55:43 +0800 Subject: [PATCH] fix #304 Signed-off-by: H-ZeX --- src/os/linux/src/os.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/os/linux/src/os.c b/src/os/linux/src/os.c index 999bc865e7..785b1dd16e 100644 --- a/src/os/linux/src/os.c +++ b/src/os/linux/src/os.c @@ -225,29 +225,29 @@ int taosOpenUDServerSocket(char *ip, short port) { // The callback functions MUST free the param pass to it after finishing use it. int taosInitTimer(void *(*callback)(void *), int ms) { - /******************************************************** - * Create SIGALRM loop thread - ********************************************************/ - pthread_t thread; - pthread_attr_t tattr; - if (pthread_attr_init(&tattr)) { - return -1; - } + /******************************************************** + * Create SIGALRM loop thread + ********************************************************/ + pthread_t thread; + pthread_attr_t tattr; + if (pthread_attr_init(&tattr)) { + return -1; + } - if (pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED)) { - return -1; - } + if (pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED)) { + return -1; + } - int *tms = (int *) malloc(sizeof(int)); - *tms = ms; - if (pthread_create(&thread, &tattr, callback, (void *) tms)) { - free(tms); - return -1; - } + int *tms = (int *) malloc(sizeof(int)); + *tms = ms; + if (pthread_create(&thread, &tattr, callback, (void *) tms)) { + free(tms); + return -1; + } - if (pthread_attr_destroy(&tattr)) { - return -1; - } + if (pthread_attr_destroy(&tattr)) { + return -1; + } - return 0; + return 0; } -- GitLab