Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143619858
D50492.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D50492.diff
View Options
Index: virtual_int.h
===================================================================
--- virtual_int.h
+++ virtual_int.h
@@ -26,6 +26,7 @@
#ifndef _VIRTUAL_INT_H_
#define _VIRTUAL_INT_H_
+#include <signal.h>
#include <samplerate.h>
#define VMAX_CHAN 64
@@ -225,6 +226,7 @@
extern char voss_dsp_rx_device[VMAX_STRING];
extern char voss_dsp_tx_device[VMAX_STRING];
extern char voss_ctl_device[VMAX_STRING];
+extern volatile sig_atomic_t voss_exit;
extern void atomic_lock(void);
extern void atomic_unlock(void);
Index: virtual_main.c
===================================================================
--- virtual_main.c
+++ virtual_main.c
@@ -1629,6 +1629,7 @@
uint8_t voss_libsamplerate_quality = SRC_SINC_FASTEST;
int voss_is_recording = 1;
int voss_has_synchronization;
+volatile sig_atomic_t voss_exit = 0;
static int voss_dsp_perm = 0666;
static int voss_do_background;
@@ -1996,6 +1997,12 @@
init_mapping(pvp);
}
+static void
+virtual_sig_exit(int sig)
+{
+ voss_exit = 1;
+}
+
static const char *
parse_options(int narg, char **pparg, int is_main)
{
@@ -2558,6 +2565,7 @@
}
const char *ptrerr;
+ struct sigaction sa;
TAILQ_INIT(&virtual_profile_client_head);
TAILQ_INIT(&virtual_profile_loopback_head);
@@ -2579,6 +2587,14 @@
signal(SIGPIPE, &virtual_pipe);
+ memset(&sa, 0, sizeof(sa));
+ sigfillset(&sa.sa_mask);
+ sa.sa_handler = virtual_sig_exit;
+ if (sigaction(SIGINT, &sa, NULL) < 0)
+ err(1, "sigaction(SIGINT)");
+ if (sigaction(SIGTERM, &sa, NULL) < 0)
+ err(1, "sigaction(SIGTERM)");
+
ptrerr = parse_options(argc, argv, 1);
if (ptrerr != NULL)
errx(EX_USAGE, "%s", ptrerr);
Index: virtual_oss.c
===================================================================
--- virtual_oss.c
+++ virtual_oss.c
@@ -271,6 +271,8 @@
rx_be->close(rx_be);
tx_be->close(tx_be);
+ if (voss_exit)
+ break;
if (need_delay)
sleep(2);
@@ -337,6 +339,8 @@
uint64_t delta_time;
/* Check if DSP device should be re-opened */
+ if (voss_exit)
+ break;
if (voss_dsp_rx_refresh || voss_dsp_tx_refresh) {
need_delay = false;
break;
@@ -897,5 +901,13 @@
}
}
}
+
+ free(buffer_dsp);
+ free(buffer_temp);
+ free(buffer_monitor);
+ free(buffer_local);
+ free(buffer_data);
+ free(buffer_orig);
+
return (NULL);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 1, 2:18 AM (19 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28248907
Default Alt Text
D50492.diff (2 KB)
Attached To
Mode
D50492: virtual_oss: Exit main loop cleanly on termination
Attached
Detach File
Event Timeline
Log In to Comment