diff --git a/tests/rigctl.c b/tests/rigctl.c index 0e6c11ccf..a10106f25 100644 --- a/tests/rigctl.c +++ b/tests/rigctl.c @@ -124,11 +124,11 @@ static const int have_rl = 1; #endif -int interactive = 1; /* if no cmd on command line, switch to interactive */ -int prompt = 1; /* Print prompt in rigctl */ -int vfo_mode = 0; /* vfo_mode = 0 means target VFO is 'currVFO' */ +thread_local int interactive = 1; /* if no cmd on command line, switch to interactive */ +thread_local int prompt = 1; /* Print prompt in rigctl */ +thread_local int vfo_mode = 0; /* vfo_mode = 0 means target VFO is 'currVFO' */ -char send_cmd_term = '\r'; /* send_cmd termination char */ +thread_local char send_cmd_term = '\r'; /* send_cmd termination char */ int main(int argc, char *argv[]) { diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 350027968..d27dfa8c4 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -587,17 +587,12 @@ static int next_word(char *buffer, int argc, char *argv[], int newline) }) -extern int interactive; -extern int prompt; -extern int vfo_mode; -extern char send_cmd_term; -int ext_resp = 0; -unsigned char resp_sep = '\n'; /* Default response separator */ -/* Note that vfo_mode and ext_resp are not thread safe - * So to run either a vfo_mode or ext_resp mode rigctld it needs to be - * on a separate rigctld instance on a different port. One port per vfo_mode/ext_resp combination for a maximum of 4 instances/ports to cover all 4 combos - * Significant rewrite to fix this for 1 instance - */ +extern thread_local int interactive; +extern thread_local int prompt; +extern thread_local int vfo_mode; +extern thread_local char send_cmd_term; +thread_local int ext_resp = 0; +thread_local unsigned char resp_sep = '\n'; /* Default response separator */ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, sync_cb_t sync_cb) { diff --git a/tests/rigctlcom.c b/tests/rigctlcom.c index ff2cb7bcd..781605e19 100644 --- a/tests/rigctlcom.c +++ b/tests/rigctlcom.c @@ -128,11 +128,11 @@ static sig_atomic_t volatile ctrl_c; static int volatile ctrl_c; #endif -int interactive = 1; /* no cmd because of daemon */ -int prompt = 0; /* Daemon mode for rigparse return string */ -int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */ +thread_local int interactive = 1; /* no cmd because of daemon */ +thread_local int prompt = 0; /* Daemon mode for rigparse return string */ +thread_local int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */ -char send_cmd_term = '\r'; /* send_cmd termination char */ +thread_local char send_cmd_term = '\r'; /* send_cmd termination char */ #define MAXCONFLEN 128 diff --git a/tests/rigctld.c b/tests/rigctld.c index 38dd2aee8..8839d7bc8 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -137,11 +137,11 @@ static sig_atomic_t volatile ctrl_c; static int volatile ctrl_c; #endif -int interactive = 1; /* no cmd because of daemon */ -int prompt = 0; /* Daemon mode for rigparse return string */ -int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */ +thread_local int interactive = 1; /* no cmd because of daemon */ +thread_local int prompt = 0; /* Daemon mode for rigparse return string */ +thread_local int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */ -char send_cmd_term = '\r'; /* send_cmd termination char */ +thread_local char send_cmd_term = '\r'; /* send_cmd termination char */ const char *portno = "4532"; const char *src_addr = NULL; /* INADDR_ANY */ diff --git a/tests/rotctl.c b/tests/rotctl.c index 0d79f562a..1e00a04a4 100644 --- a/tests/rotctl.c +++ b/tests/rotctl.c @@ -112,10 +112,10 @@ static const int have_rl = 1; #endif -int interactive = 1; /* if no cmd on command line, switch to interactive */ -int prompt = 1; /* Print prompt in rotctl */ +thread_local int interactive = 1; /* if no cmd on command line, switch to interactive */ +thread_local int prompt = 1; /* Print prompt in rotctl */ -char send_cmd_term = '\r'; /* send_cmd termination char */ +thread_local char send_cmd_term = '\r'; /* send_cmd termination char */ int main(int argc, char *argv[]) diff --git a/tests/rotctl_parse.c b/tests/rotctl_parse.c index 7fedca4ad..3406132fa 100644 --- a/tests/rotctl_parse.c +++ b/tests/rotctl_parse.c @@ -495,11 +495,11 @@ static int next_word(char *buffer, int argc, char *argv[], int newline) }) -extern int interactive; -extern int prompt; -extern char send_cmd_term; -int ext_resp = 0; -unsigned char resp_sep = '\n'; /* Default response separator */ +extern thread_local int interactive; +extern thread_local int prompt; +extern thread_local char send_cmd_term; +thread_local int ext_resp = 0; +thread_local unsigned char resp_sep = '\n'; /* Default response separator */ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc) diff --git a/tests/rotctld.c b/tests/rotctld.c index 660a7d450..3dcc10b3e 100644 --- a/tests/rotctld.c +++ b/tests/rotctld.c @@ -103,13 +103,13 @@ static struct option long_options[] = {0, 0, 0, 0} }; -int interactive = 1; /* no cmd because of daemon */ -int prompt = 0 ; /* Daemon mode for rigparse return string */ +thread_local int interactive = 1; /* no cmd because of daemon */ +thread_local int prompt = 0 ; /* Daemon mode for rigparse return string */ -const char *portno = "4533"; -const char *src_addr = NULL; /* INADDR_ANY */ +thread_local const char *portno = "4533"; +thread_local const char *src_addr = NULL; /* INADDR_ANY */ -char send_cmd_term = '\r'; /* send_cmd termination char */ +thread_local char send_cmd_term = '\r'; /* send_cmd termination char */ #define MAXCONFLEN 128