Handle Linux crash

Last modified by Lev Andronov on 2024/10/28 16:43

Please note that when you use KYFG_StreamCreateAndAlloc(), the memory buffers allocated by our library are marked as such. This distinguishes them from buffers allocated by the user program and announced using KYFG_BufferAnnounce(), which should also be released by the user program. These buffers are released by our library when the user calls KYFG_StreamDelete(), which should be done by the user's application.

If you do not call KYFG_StreamDelete(), it will be internally called by KYFG_CameraClose(), which should also be done by the user's application. If, for some reason, you also do not call KYFG_CameraClose(), it will be internally called by KYFG_Close(), which your application must call at some point.

We would like to emphasize that your application should not rely on those automatic internal calls. Instead, to fully comply with our API specification, your application should explicitly call KYFG_StreamDelete() for each stream it created with KYFG_StreamCreateAndAlloc() or KYFG_StreamCreate(), then KYFG_CameraClose() for each camera, and KYFG_Close() for the frame grabber.


How to implement the crash handler

Please refer to Linux manual pages for more details: signal(7) and sigaction(2)

Code sample 1:
signal(SIGSEGV, handler);   // install our handler
Code sample 2:
void setApplicationCrashHandler (CrashHandlerFunction handler)
{
jassert (handler != nullptr); ~/~/ This must be a valid function.
globalCrashHandler = handler;
\\**const int signals[] = { SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGABRT, SIGSYS };
\\for (int i = 0; i {
signal (signals[i], handleCrash);**
}
}

Created by Lev Andronov on 2024/04/08 17:56
KAYA Instruments © 2024. All Rights Reserved.