aws-samples / amazon-kinesis-video-streams-producer-embedded-c

Light-wight Amazon Kinesis Video Streams Producer SDK For FreeRTOS/Embedded Linux
Apache License 2.0
29 stars 18 forks source link

Register interrupt signal handler so user can exit sample by using Ctrl+c #31

Closed weichihl closed 2 years ago

weichihl commented 2 years ago

When user press Ctrl+c, it'll send an interrupt signal to program and the default behavior is exiting the program. This commit adds an interrupt signal handler. When user press Ctrl+c, the handler sets a global variable to let each thread know it's about exiting. If something stuck there, user can press Ctrl+c again and it'll exit program immediately.

Once we can exit program gracefully, we can use valgrid to do some tests like memory leak.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.