Signed-off-by: H-ZeX <hzx20112012@gmail.com>
This commit is contained in:
H-ZeX 2019-08-09 00:55:43 +08:00
parent 0f3a8a4bc5
commit ba81feaa86
No known key found for this signature in database
GPG Key ID: B363CD8898542D21
1 changed files with 21 additions and 21 deletions

View File

@ -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;
}