mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-14 08:39:27 +08:00
restore CatchSignals to fix API compatibility
This commit is contained in:
parent
c5105c5325
commit
78ced35a8b
@ -253,6 +253,25 @@ size_t TessBaseAPI::getOpenCLDevice(void **data) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the thresholded image to stderr as a PBM file on receipt of a
|
||||||
|
* SIGSEGV, SIGFPE, or SIGBUS signal. (Linux/Unix only).
|
||||||
|
*/
|
||||||
|
void TessBaseAPI::CatchSignals() {
|
||||||
|
#ifdef __linux__
|
||||||
|
struct sigaction action;
|
||||||
|
memset(&action, 0, sizeof(action));
|
||||||
|
action.sa_handler = &signal_exit;
|
||||||
|
action.sa_flags = SA_RESETHAND;
|
||||||
|
sigaction(SIGSEGV, &action, nullptr);
|
||||||
|
sigaction(SIGFPE, &action, nullptr);
|
||||||
|
sigaction(SIGBUS, &action, nullptr);
|
||||||
|
#else
|
||||||
|
// Warn API users that an implementation is needed.
|
||||||
|
tprintf("CatchSignals has no non-linux implementation!\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the input file. Needed only for training and
|
* Set the name of the input file. Needed only for training and
|
||||||
* loading a UNLV zone file.
|
* loading a UNLV zone file.
|
||||||
|
@ -107,6 +107,12 @@ class TESS_API TessBaseAPI {
|
|||||||
*/
|
*/
|
||||||
static size_t getOpenCLDevice(void **device);
|
static size_t getOpenCLDevice(void **device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the thresholded image to stderr as a PBM file on receipt of a
|
||||||
|
* SIGSEGV, SIGFPE, or SIGBUS signal. (Linux/Unix only).
|
||||||
|
*/
|
||||||
|
static void CatchSignals();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the input file. Needed for training and
|
* Set the name of the input file. Needed for training and
|
||||||
* reading a UNLV zone file, and for searchable PDF output.
|
* reading a UNLV zone file, and for searchable PDF output.
|
||||||
|
Loading…
Reference in New Issue
Block a user