From 6d28b6b1b1323f06d641e04f728dccb7b20579e6 Mon Sep 17 00:00:00 2001 From: Michael Black Date: Wed, 31 Jul 2019 15:48:35 -0500 Subject: [PATCH] Adding thread_local definition to rig.h --- include/hamlib/rig.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 1a1f81b47..a4e18e104 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -57,6 +57,25 @@ # define __END_DECLS /* empty */ #endif +#ifndef thread_local +# if __STDC_VERSION__ >= 201112 && !defined __STDC_NO_THREADS__ +# define thread_local _Thread_local +# elif defined _WIN32 && ( \ + defined _MSC_VER || \ + defined __ICL || \ + defined __DMC__ || \ + defined __BORLANDC__ ) +# define thread_local __declspec(thread) +/* note that ICC (linux) and Clang are covered by __GNUC__ */ +# elif defined __GNUC__ || \ + defined __SUNPRO_C || \ + defined __xlC__ +# define thread_local __thread +# else +# error "Cannot define thread_local" +# endif +#endif + /* HAMLIB_PARAMS is a macro used to wrap function prototypes, so that compilers * that don't understand ANSI C prototypes still work, and ANSI C * compilers can issue warnings about type mismatches. */ @@ -1732,7 +1751,7 @@ struct rig_state { rmode_t current_mode; /*!< Mode currently set */ pbwidth_t current_width; /*!< Passband width currently set */ vfo_t tx_vfo; /*!< Tx VFO currently set */ - int mode_list; /*!< Complete list of modes for this rig */ + rmode_t mode_list; /*!< Complete list of modes for this rig */ int transmit; /*!< rig should be transmitting i.e. hard wired PTT asserted - used by rigs that don't do CAT while in Tx */