diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2016-07-09 11:15:48 +0200 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2016-07-09 11:27:02 +0200 |
commit | f39ee2f15a5ab52efe12fa4ac50d04e473a613c4 (patch) | |
tree | d7fcc2dd6f1993537707f1d5143767140b45bb0a /src/common | |
parent | 26ab26db48c7042a38ab4ded612df29aef75e4ba (diff) |
common code: Add support for main loop handler
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/main.h | 2 | ||||
-rw-r--r-- | src/common/main_common.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/common/main.h b/src/common/main.h index 6a67717..c2abb6f 100644 --- a/src/common/main.h +++ b/src/common/main.h @@ -37,5 +37,5 @@ void opt_switch_common(int c, char *arg0, int *skip_args); extern int quit; 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)); diff --git a/src/common/main_common.c b/src/common/main_common.c index 68d8584..ac223f4 100644 --- a/src/common/main_common.c +++ b/src/common/main_common.c @@ -277,7 +277,7 @@ static int get_char() } /* 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; sender_t *sender; @@ -332,6 +332,9 @@ next_char: /* process audio of built-in call control */ process_call(c); + if (myhandler) + myhandler(); + /* sleep a while */ usleep(interval * 1000); } |