Merge pull request #19805 from freemine/pthread_cleanup_push
typo: pthread_cleanup_push/pop better exist in pair
This commit is contained in:
commit
5d6d6e6e16
|
@ -114,27 +114,28 @@ static void *taosProcessAlarmSignal(void *tharg) {
|
||||||
|
|
||||||
taosThreadCleanupPush(taosDeleteTimer, &timerId);
|
taosThreadCleanupPush(taosDeleteTimer, &timerId);
|
||||||
|
|
||||||
struct itimerspec ts;
|
do {
|
||||||
ts.it_value.tv_sec = 0;
|
struct itimerspec ts;
|
||||||
ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK;
|
ts.it_value.tv_sec = 0;
|
||||||
ts.it_interval.tv_sec = 0;
|
ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK;
|
||||||
ts.it_interval.tv_nsec = 1000000 * MSECONDS_PER_TICK;
|
ts.it_interval.tv_sec = 0;
|
||||||
|
ts.it_interval.tv_nsec = 1000000 * MSECONDS_PER_TICK;
|
||||||
|
|
||||||
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;
|
|
||||||
while (!stopTimer) {
|
|
||||||
if (sigwait(&sigset, &signo)) {
|
|
||||||
// printf("Failed to wait signal: number %d", signo);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
/* //printf("Signal handling: number %d ......\n", signo); */
|
|
||||||
|
|
||||||
callback(0);
|
int signo;
|
||||||
}
|
while (!stopTimer) {
|
||||||
|
if (sigwait(&sigset, &signo)) {
|
||||||
|
// printf("Failed to wait signal: number %d", signo);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* //printf("Signal handling: number %d ......\n", signo); */
|
||||||
|
callback(0);
|
||||||
|
}
|
||||||
|
} while (0);
|
||||||
|
|
||||||
taosThreadCleanupPop(1);
|
taosThreadCleanupPop(1);
|
||||||
|
|
||||||
|
|
|
@ -1048,26 +1048,28 @@ void *shellThreadLoop(void *arg) {
|
||||||
taosGetOldTerminalMode();
|
taosGetOldTerminalMode();
|
||||||
taosThreadCleanupPush(shellCleanup, NULL);
|
taosThreadCleanupPush(shellCleanup, NULL);
|
||||||
|
|
||||||
char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE);
|
|
||||||
if (command == NULL) {
|
|
||||||
printf("failed to malloc command\r\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
memset(command, 0, SHELL_MAX_COMMAND_SIZE);
|
char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE);
|
||||||
taosSetTerminalMode();
|
if (command == NULL) {
|
||||||
|
printf("failed to malloc command\r\n");
|
||||||
if (shellReadCommand(command) != 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosResetTerminalMode();
|
do {
|
||||||
} while (shellRunCommand(command, true) == 0);
|
memset(command, 0, SHELL_MAX_COMMAND_SIZE);
|
||||||
|
taosSetTerminalMode();
|
||||||
|
|
||||||
taosMemoryFreeClear(command);
|
if (shellReadCommand(command) != 0) {
|
||||||
shellWriteHistory();
|
break;
|
||||||
shellExit();
|
}
|
||||||
|
|
||||||
|
taosResetTerminalMode();
|
||||||
|
} while (shellRunCommand(command, true) == 0);
|
||||||
|
|
||||||
|
taosMemoryFreeClear(command);
|
||||||
|
shellWriteHistory();
|
||||||
|
shellExit();
|
||||||
|
} while (0);
|
||||||
|
|
||||||
taosThreadCleanupPop(1);
|
taosThreadCleanupPop(1);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue