common code: Add support for main loop handler
This commit is contained in:
@@ -365,7 +365,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "Error setting SCHED_RR with prio %d\n", rt_prio);
|
fprintf(stderr, "Error setting SCHED_RR with prio %d\n", rt_prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
main_loop(&quit, latency, interval);
|
main_loop(&quit, latency, interval, NULL);
|
||||||
|
|
||||||
if (rt_prio > 0) {
|
if (rt_prio > 0) {
|
||||||
struct sched_param schedp;
|
struct sched_param schedp;
|
||||||
|
@@ -193,7 +193,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "Error setting SCHED_RR with prio %d\n", rt_prio);
|
fprintf(stderr, "Error setting SCHED_RR with prio %d\n", rt_prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
main_loop(&quit, latency, interval);
|
main_loop(&quit, latency, interval, NULL);
|
||||||
|
|
||||||
if (rt_prio > 0) {
|
if (rt_prio > 0) {
|
||||||
struct sched_param schedp;
|
struct sched_param schedp;
|
||||||
|
@@ -208,7 +208,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "Error setting SCHED_RR with prio %d\n", rt_prio);
|
fprintf(stderr, "Error setting SCHED_RR with prio %d\n", rt_prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
main_loop(&quit, latency, interval);
|
main_loop(&quit, latency, interval, NULL);
|
||||||
|
|
||||||
if (rt_prio > 0) {
|
if (rt_prio > 0) {
|
||||||
struct sched_param schedp;
|
struct sched_param schedp;
|
||||||
|
@@ -313,7 +313,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "Error setting SCHED_RR with prio %d\n", rt_prio);
|
fprintf(stderr, "Error setting SCHED_RR with prio %d\n", rt_prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
main_loop(&quit, latency, interval);
|
main_loop(&quit, latency, interval, NULL);
|
||||||
|
|
||||||
if (rt_prio > 0) {
|
if (rt_prio > 0) {
|
||||||
struct sched_param schedp;
|
struct sched_param schedp;
|
||||||
|
@@ -37,5 +37,5 @@ void opt_switch_common(int c, char *arg0, int *skip_args);
|
|||||||
extern int quit;
|
extern int quit;
|
||||||
void sighandler(int sigset);
|
void sighandler(int sigset);
|
||||||
|
|
||||||
void main_loop(int *quit, int latency, int interval);
|
void main_loop(int *quit, int latency, int interval, void (*myhandler)(void));
|
||||||
|
|
||||||
|
@@ -277,7 +277,7 @@ static int get_char()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Loop through all transceiver instances of one network. */
|
/* Loop through all transceiver instances of one network. */
|
||||||
void main_loop(int *quit, int latency, int interval)
|
void main_loop(int *quit, int latency, int interval, void (*myhandler)(void))
|
||||||
{
|
{
|
||||||
int latspl;
|
int latspl;
|
||||||
sender_t *sender;
|
sender_t *sender;
|
||||||
@@ -332,6 +332,9 @@ next_char:
|
|||||||
/* process audio of built-in call control */
|
/* process audio of built-in call control */
|
||||||
process_call(c);
|
process_call(c);
|
||||||
|
|
||||||
|
if (myhandler)
|
||||||
|
myhandler();
|
||||||
|
|
||||||
/* sleep a while */
|
/* sleep a while */
|
||||||
usleep(interval * 1000);
|
usleep(interval * 1000);
|
||||||
}
|
}
|
||||||
|
@@ -286,7 +286,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "Error setting SCHED_RR with prio %d\n", rt_prio);
|
fprintf(stderr, "Error setting SCHED_RR with prio %d\n", rt_prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
main_loop(&quit, latency, interval);
|
main_loop(&quit, latency, interval, NULL);
|
||||||
|
|
||||||
if (rt_prio > 0) {
|
if (rt_prio > 0) {
|
||||||
struct sched_param schedp;
|
struct sched_param schedp;
|
||||||
|
Reference in New Issue
Block a user