未验证 提交 5d6d6e6e 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #19805 from freemine/pthread_cleanup_push

typo: pthread_cleanup_push/pop better exist in pair
...@@ -114,6 +114,7 @@ static void *taosProcessAlarmSignal(void *tharg) { ...@@ -114,6 +114,7 @@ static void *taosProcessAlarmSignal(void *tharg) {
taosThreadCleanupPush(taosDeleteTimer, &timerId); taosThreadCleanupPush(taosDeleteTimer, &timerId);
do {
struct itimerspec ts; struct itimerspec ts;
ts.it_value.tv_sec = 0; ts.it_value.tv_sec = 0;
ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK; ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK;
...@@ -122,7 +123,7 @@ static void *taosProcessAlarmSignal(void *tharg) { ...@@ -122,7 +123,7 @@ static void *taosProcessAlarmSignal(void *tharg) {
if (timer_settime(timerId, 0, &ts, NULL)) { if (timer_settime(timerId, 0, &ts, NULL)) {
// printf("Failed to init timer"); // printf("Failed to init timer");
return NULL; break;
} }
int signo; int signo;
...@@ -132,9 +133,9 @@ static void *taosProcessAlarmSignal(void *tharg) { ...@@ -132,9 +133,9 @@ static void *taosProcessAlarmSignal(void *tharg) {
continue; continue;
} }
/* //printf("Signal handling: number %d ......\n", signo); */ /* //printf("Signal handling: number %d ......\n", signo); */
callback(0); callback(0);
} }
} while (0);
taosThreadCleanupPop(1); taosThreadCleanupPop(1);
......
...@@ -1048,10 +1048,11 @@ void *shellThreadLoop(void *arg) { ...@@ -1048,10 +1048,11 @@ void *shellThreadLoop(void *arg) {
taosGetOldTerminalMode(); taosGetOldTerminalMode();
taosThreadCleanupPush(shellCleanup, NULL); taosThreadCleanupPush(shellCleanup, NULL);
do {
char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE); char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE);
if (command == NULL) { if (command == NULL) {
printf("failed to malloc command\r\n"); printf("failed to malloc command\r\n");
return NULL; break;
} }
do { do {
...@@ -1068,6 +1069,7 @@ void *shellThreadLoop(void *arg) { ...@@ -1068,6 +1069,7 @@ void *shellThreadLoop(void *arg) {
taosMemoryFreeClear(command); taosMemoryFreeClear(command);
shellWriteHistory(); shellWriteHistory();
shellExit(); shellExit();
} while (0);
taosThreadCleanupPop(1); taosThreadCleanupPop(1);
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册