Clean-up: modernize pretty_xml.cpp
[lttng-tools.git] / include / lttng / health-internal.hpp
index b1dc33047db713aec10181496d8edd83c4dbd6fa..eee164cb141d4b86ed009d52d31c8ccfa9f5508e 100644 (file)
  */
 
 #include <common/compat/time.hpp>
+#include <common/macros.hpp>
+
+#include <lttng/health.h>
+
 #include <pthread.h>
+#include <urcu/list.h>
 #include <urcu/tls-compat.h>
 #include <urcu/uatomic.h>
-#include <urcu/list.h>
-#include <lttng/health.h>
-#include <common/macros.hpp>
 
 /*
  * These are the value added to the current state depending of the position in
  * the thread where is either waiting on a poll() or running in the code.
  */
-#define HEALTH_POLL_VALUE      (1UL << 0)
-#define HEALTH_CODE_VALUE      (1UL << 1)
+#define HEALTH_POLL_VALUE (1UL << 0)
+#define HEALTH_CODE_VALUE (1UL << 1)
 
-#define HEALTH_IS_IN_POLL(x)   ((x) & HEALTH_POLL_VALUE)
+#define HEALTH_IS_IN_POLL(x) ((x) &HEALTH_POLL_VALUE)
 
 struct health_app;
 
 enum health_flags {
-       HEALTH_ERROR                     = (1U << 0),
+       HEALTH_ERROR = (1U << 0),
 };
 
 struct health_state {
@@ -43,27 +45,27 @@ struct health_state {
        /*
         * current and flags are updated by multiple threads concurrently.
         */
-       unsigned long current;          /* progress counter, updated atomically */
-       enum health_flags flags;        /* other flags, updated atomically */
-       int type;                       /* Indicates the nature of the thread. */
+       unsigned long current; /* progress counter, updated atomically */
+       enum health_flags flags; /* other flags, updated atomically */
+       int type; /* Indicates the nature of the thread. */
        /* Node of the global TLS state list. */
        struct cds_list_head node;
 };
 
 enum health_cmd {
-       HEALTH_CMD_CHECK                = 0,
+       HEALTH_CMD_CHECK = 0,
 };
 
 struct health_comm_msg {
-       uint32_t cmd;           /* enum health_cmd */
+       uint32_t cmd; /* enum health_cmd */
 } LTTNG_PACKED;
 
 struct health_comm_reply {
-       uint64_t ret_code;      /* bitmask of threads in bad health */
+       uint64_t ret_code; /* bitmask of threads in bad health */
 } 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
@@ -73,10 +75,9 @@ extern DECLARE_URCU_TLS(struct health_state, health_state);
 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);
 }
 
 /*
@@ -87,10 +88,9 @@ static inline void health_poll_entry()
 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);
 }
 
 /*
@@ -99,7 +99,7 @@ static inline void health_poll_exit()
  */
 static inline void health_code_update()
 {
-       uatomic_add(&URCU_TLS(health_state).current, HEALTH_CODE_VALUE);
+       uatomic_add(&health_state.current, HEALTH_CODE_VALUE);
 }
 
 /*
@@ -107,7 +107,7 @@ static inline void health_code_update()
  */
 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);
This page took 0.024558 seconds and 4 git commands to generate.