} LTTNG_PACKED;
/* Declare TLS health state. */
-extern DECLARE_URCU_TLS(struct health_state, health_state);
+extern thread_local struct health_state health_state;
/*
* Update current counter by 1 to indicate that the thread entered or left a
static inline void health_poll_entry()
{
/* Code MUST be in code execution state which is an even number. */
- LTTNG_ASSERT(!(uatomic_read(&URCU_TLS(health_state).current) & HEALTH_POLL_VALUE));
+ LTTNG_ASSERT(!(uatomic_read(&health_state.current) & HEALTH_POLL_VALUE));
- uatomic_add(&URCU_TLS(health_state).current, HEALTH_POLL_VALUE);
+ uatomic_add(&health_state.current, HEALTH_POLL_VALUE);
}
/*
static inline void health_poll_exit()
{
/* Code MUST be in poll execution state which is an odd number. */
- LTTNG_ASSERT(uatomic_read(&URCU_TLS(health_state).current) & HEALTH_POLL_VALUE);
+ LTTNG_ASSERT(uatomic_read(&health_state.current) & HEALTH_POLL_VALUE);
- uatomic_add(&URCU_TLS(health_state).current, HEALTH_POLL_VALUE);
+ uatomic_add(&health_state.current, HEALTH_POLL_VALUE);
}
/*
*/
static inline void health_code_update()
{
- uatomic_add(&URCU_TLS(health_state).current, HEALTH_CODE_VALUE);
+ uatomic_add(&health_state.current, HEALTH_CODE_VALUE);
}
/*
*/
static inline void health_error()
{
- uatomic_or(&URCU_TLS(health_state).flags, HEALTH_ERROR);
+ uatomic_or(&health_state.flags, HEALTH_ERROR);
}
struct health_app *health_app_create(int nr_types);
int lttng_opt_abort_on_error = -1;
/* TLS variable that contains the time of one single log entry. */
-DEFINE_URCU_TLS(struct log_time, error_log_time);
+thread_local struct log_time error_log_time;
} /* namespace */
-DEFINE_URCU_TLS(const char *, logger_thread_name);
+thread_local const char * logger_thread_name;
const char *log_add_time()
{
}
/* Format time in the TLS variable. */
- ret = snprintf(URCU_TLS(error_log_time).str,
- sizeof(URCU_TLS(error_log_time).str),
+ ret = snprintf(error_log_time.str,
+ sizeof(error_log_time.str),
"%02d:%02d:%02d.%09ld",
tm.tm_hour,
tm.tm_min,
}
errno = errsv;
- return URCU_TLS(error_log_time).str;
+ return error_log_time.str;
error:
/* Return an empty string on error so logging is not affected. */
int ret;
LTTNG_ASSERT(name);
- URCU_TLS(logger_thread_name) = name;
+ logger_thread_name = name;
if (set_pthread_name) {
ret = lttng_thread_setname(name);
/* Format: 00:00:00.000000000 plus NULL byte. */
char str[19];
};
-extern DECLARE_URCU_TLS(const char *, logger_thread_name);
+
+extern thread_local const char * logger_thread_name;
extern int lttng_opt_quiet;
extern int lttng_opt_verbose;
msg " - %s [%s]: " fmt " (in %s() at " __FILE__ \
":" XSTR(__LINE__) ")\n", \
log_add_time(), \
- URCU_TLS(logger_thread_name) ?: generic_name, \
+ logger_thread_name ?: generic_name, \
##args, \
__func__); \
} \
__lttng_print(type, \
msg " - %s [%s]: " fmt "\n", \
log_add_time(), \
- URCU_TLS(logger_thread_name) ?: generic_name, \
+ logger_thread_name ?: generic_name, \
##args); \
} \
} while (0)
};
/* Define TLS health state. */
-DEFINE_URCU_TLS(struct health_state, health_state);
+thread_local struct health_state health_state;
/*
* Initialize health check subsytem.
LTTNG_ASSERT(type < ha->nr_types);
/* Init TLS state. */
- uatomic_set(&URCU_TLS(health_state).last, 0);
- uatomic_set(&URCU_TLS(health_state).last_time.tv_sec, 0);
- uatomic_set(&URCU_TLS(health_state).last_time.tv_nsec, 0);
- uatomic_set(&URCU_TLS(health_state).current, 0);
- uatomic_set(&URCU_TLS(health_state).flags, (health_flags) 0);
- uatomic_set(&URCU_TLS(health_state).type, type);
+ uatomic_set(&health_state.last, 0);
+ uatomic_set(&health_state.last_time.tv_sec, 0);
+ uatomic_set(&health_state.last_time.tv_nsec, 0);
+ uatomic_set(&health_state.current, 0);
+ uatomic_set(&health_state.flags, (health_flags) 0);
+ uatomic_set(&health_state.type, type);
/* Add it to the global TLS state list. */
state_lock(ha);
- cds_list_add(&URCU_TLS(health_state).node, &ha->list);
+ cds_list_add(&health_state.node, &ha->list);
state_unlock(ha);
}
* On error, set the global_error_state since we are about to remove
* the node from the global list.
*/
- if (uatomic_read(&URCU_TLS(health_state).flags) & HEALTH_ERROR) {
- uatomic_set(&ha->flags[URCU_TLS(health_state).type], HEALTH_ERROR);
+ if (uatomic_read(&health_state.flags) & HEALTH_ERROR) {
+ uatomic_set(&ha->flags[health_state.type], HEALTH_ERROR);
}
- cds_list_del(&URCU_TLS(health_state).node);
+ cds_list_del(&health_state.node);
state_unlock(ha);
}