osmo-gapk: abort the processing queue on SIGINT

Instead of immediately shutting down the application, it is
better to try to break the processing queue first, and stop
the execution immediately if second SIGINT is received.
diff --git a/src/app_osmo_gapk.c b/src/app_osmo_gapk.c
index 4c13570..d02ccbe 100644
--- a/src/app_osmo_gapk.c
+++ b/src/app_osmo_gapk.c
@@ -67,8 +67,8 @@
 struct gapk_state
 {
 	struct gapk_options opts;
-
 	struct osmo_gapk_pq *pq;
+	int exit;
 
 	struct {
 		struct {
@@ -622,7 +622,11 @@
 	if (rv)
 		return rv;
 
-	for (frames=0; !(rv = osmo_gapk_pq_execute(gs->pq)); frames++);
+	for (frames = 0; !gs->exit; frames++) {
+		rv = osmo_gapk_pq_execute(gs->pq);
+		if (rv)
+			break;
+	}
 
 	LOGP(DAPP, LOGL_NOTICE, "Processed %d frames\n", frames);
 
@@ -649,11 +653,14 @@
 
 static void signal_handler(int signal)
 {
+	fprintf(stderr, "signal %u received\n", signal);
+
 	switch (signal) {
 	case SIGINT:
-		fprintf(stderr, "catching sigint, shutting down...\n");
-		app_shutdown();
-		exit(0);
+		if (gs->exit++) {
+			app_shutdown();
+			exit(0);
+		}
 		break;
 	default:
 		break;