From: Tae-Young Chung Date: Tue, 25 Jun 2024 06:51:30 +0000 (+0900) Subject: Add signal handler stopping X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fefa66d4ebe262cc4362dba4a6a84a09f5ad2fcb;p=platform%2Fcore%2Fapi%2Fsingleo.git Add signal handler stopping Change-Id: I46825867b78620fed18e0453417b7921cbc12ac3 Signed-off-by: Tae-Young Chung --- diff --git a/test/services/smartpointer.cpp b/test/services/smartpointer.cpp index 47245e7..bb7b13e 100644 --- a/test/services/smartpointer.cpp +++ b/test/services/smartpointer.cpp @@ -27,8 +27,6 @@ using namespace testing; using namespace std; - - // A part of PoseVector should be moved to a common header. struct Point3f { @@ -42,6 +40,14 @@ struct Context { bool is_loop_exit = false; }; +static Context context {}; + +static void signalCallbackHandler(int signum) +{ + cout << "Terminating..." << endl; + context.is_loop_exit = true; +} + void user_callback(void *user_data) { Context *context = static_cast(user_data); @@ -73,8 +79,7 @@ void data_feeder_cb(unsigned char *buffer, unsigned int width, unsigned int heig int main(const int argc, const char *argv[]) { - Context context {}; - + signal(SIGINT, signalCallbackHandler); singleo_service_create("service=smart_pointer, input_feed=camera, camera_id=4, fps=30, async=0", &context.handle);