Doing non-trivial things in signal handler is bad. If you want to pause, do it in another thread. Though libusb operations are generally thread safe, I cannot guarantee everything above is thread safe when calling start()/stop() while waitForNewFrame().
| 58 | //everything above is thread safe when calling start()/stop() while |
| 59 | //waitForNewFrame(). |
| 60 | void sigusr1_handler(int s) |
| 61 | { |
| 62 | if (devtopause == 0) |
| 63 | return; |
| 64 | /// [pause] |
| 65 | if (protonect_paused) |
| 66 | devtopause->start(); |
| 67 | else |
| 68 | devtopause->stop(); |
| 69 | protonect_paused = !protonect_paused; |
| 70 | /// [pause] |
| 71 | } |
| 72 | |
| 73 | //The following demostrates how to create a custom logger |
| 74 | /// [logger] |