-
-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
21 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,8 @@ | ||
#include "mediapipe_api/common.h" | ||
|
||
namespace { | ||
thread_local struct sigaction orig_act; | ||
thread_local sigjmp_buf abrt_jbuf; | ||
thread_local struct sigaction mp_api::orig_act; | ||
thread_local sigjmp_buf mp_api::abrt_jbuf; | ||
|
||
void sigabrt_handler(int sig) { | ||
siglongjmp(abrt_jbuf, 1); | ||
} | ||
void mp_api::sigabrt_handler(int sig) { | ||
siglongjmp(abrt_jbuf, 1); | ||
} | ||
|
||
bool sigabrt_is_not_received() { | ||
return sigsetjmp(abrt_jbuf, 1) == 0; | ||
} | ||
|
||
void setup_sigaction() { | ||
struct sigaction act; | ||
|
||
sigemptyset(&act.sa_mask); | ||
act.sa_flags = 0; | ||
act.sa_handler = sigabrt_handler; | ||
|
||
sigaction(SIGABRT, &act, &orig_act); | ||
} | ||
|
||
void restore_sigaction() { | ||
sigaction(SIGABRT, &orig_act, nullptr); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters