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().
| 66 | //everything above is thread safe when calling start()/stop() while |
| 67 | //waitForNewFrame(). |
| 68 | void sigusr1_handler(int s) |
| 69 | { |
| 70 | if (devtopause == 0) |
| 71 | return; |
| 72 | /// [pause] |
| 73 | if (protonect_paused) |
| 74 | devtopause->start(); |
| 75 | else |
| 76 | devtopause->stop(); |
| 77 | protonect_paused = !protonect_paused; |
| 78 | /// [pause] |
| 79 | } |
| 80 | |
| 81 | //The following demostrates how to create a custom logger |
| 82 | /// [logger] |