kopia lustrzana https://github.com/Hamlib/Hamlib
Make rigctld thread safe for vfo_mode and ext_resp and change other globals to thread_local for future reference
rodzic
6d28b6b1b1
commit
3dce8b01d1
|
@ -124,11 +124,11 @@ static const int have_rl = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int interactive = 1; /* if no cmd on command line, switch to interactive */
|
thread_local int interactive = 1; /* if no cmd on command line, switch to interactive */
|
||||||
int prompt = 1; /* Print prompt in rigctl */
|
thread_local int prompt = 1; /* Print prompt in rigctl */
|
||||||
int vfo_mode = 0; /* vfo_mode = 0 means target VFO is 'currVFO' */
|
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[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
|
@ -587,17 +587,12 @@ static int next_word(char *buffer, int argc, char *argv[], int newline)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
extern int interactive;
|
extern thread_local int interactive;
|
||||||
extern int prompt;
|
extern thread_local int prompt;
|
||||||
extern int vfo_mode;
|
extern thread_local int vfo_mode;
|
||||||
extern char send_cmd_term;
|
extern thread_local char send_cmd_term;
|
||||||
int ext_resp = 0;
|
thread_local int ext_resp = 0;
|
||||||
unsigned char resp_sep = '\n'; /* Default response separator */
|
thread_local 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, sync_cb_t sync_cb)
|
int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, sync_cb_t sync_cb)
|
||||||
{
|
{
|
||||||
|
|
|
@ -128,11 +128,11 @@ static sig_atomic_t volatile ctrl_c;
|
||||||
static int volatile ctrl_c;
|
static int volatile ctrl_c;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int interactive = 1; /* no cmd because of daemon */
|
thread_local int interactive = 1; /* no cmd because of daemon */
|
||||||
int prompt = 0; /* Daemon mode for rigparse return string */
|
thread_local 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 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
|
#define MAXCONFLEN 128
|
||||||
|
|
||||||
|
|
|
@ -137,11 +137,11 @@ static sig_atomic_t volatile ctrl_c;
|
||||||
static int volatile ctrl_c;
|
static int volatile ctrl_c;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int interactive = 1; /* no cmd because of daemon */
|
thread_local int interactive = 1; /* no cmd because of daemon */
|
||||||
int prompt = 0; /* Daemon mode for rigparse return string */
|
thread_local 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 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 *portno = "4532";
|
||||||
const char *src_addr = NULL; /* INADDR_ANY */
|
const char *src_addr = NULL; /* INADDR_ANY */
|
||||||
|
|
|
@ -112,10 +112,10 @@ static const int have_rl = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int interactive = 1; /* if no cmd on command line, switch to interactive */
|
thread_local int interactive = 1; /* if no cmd on command line, switch to interactive */
|
||||||
int prompt = 1; /* Print prompt in rotctl */
|
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[])
|
int main(int argc, char *argv[])
|
||||||
|
|
|
@ -495,11 +495,11 @@ static int next_word(char *buffer, int argc, char *argv[], int newline)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
extern int interactive;
|
extern thread_local int interactive;
|
||||||
extern int prompt;
|
extern thread_local int prompt;
|
||||||
extern char send_cmd_term;
|
extern thread_local char send_cmd_term;
|
||||||
int ext_resp = 0;
|
thread_local int ext_resp = 0;
|
||||||
unsigned char resp_sep = '\n'; /* Default response separator */
|
thread_local unsigned char resp_sep = '\n'; /* Default response separator */
|
||||||
|
|
||||||
|
|
||||||
int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc)
|
int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc)
|
||||||
|
|
|
@ -103,13 +103,13 @@ static struct option long_options[] =
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
int interactive = 1; /* no cmd because of daemon */
|
thread_local int interactive = 1; /* no cmd because of daemon */
|
||||||
int prompt = 0 ; /* Daemon mode for rigparse return string */
|
thread_local int prompt = 0 ; /* Daemon mode for rigparse return string */
|
||||||
|
|
||||||
const char *portno = "4533";
|
thread_local const char *portno = "4533";
|
||||||
const char *src_addr = NULL; /* INADDR_ANY */
|
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
|
#define MAXCONFLEN 128
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue