-static const struct timespec time_delta = {
- .tv_sec = DEFAULT_HEALTH_CHECK_DELTA_S,
- .tv_nsec = DEFAULT_HEALTH_CHECK_DELTA_NS,
+/*
+ * An application-specific error state for unregistered thread keeps
+ * track of thread errors. A thread reporting a health error, normally
+ * unregisters and quits. This makes the TLS health state not available
+ * to the health_check_state() call so on unregister we update this
+ * global error array so we can keep track of which thread was on error
+ * if the TLS health state has been removed.
+ */
+struct health_app {
+ /* List of health state, for each application thread */
+ struct cds_list_head list;
+ /*
+ * This lock ensures that TLS memory used for the node and its
+ * container structure don't get reclaimed after the TLS owner
+ * thread exits until we have finished using it.
+ */
+ pthread_mutex_t lock;
+ int nr_types;
+ struct timespec time_delta;
+ /* Health flags containing thread type error state */
+ enum health_flags *flags;