summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8082d47)
Use CMM_LOAD_SHARED and CMM_STORE_SHARED, which are strictly
equivalent to a volatile variable, in line with the rest of the
lttng-tools project.
Also move its declaration to a header, rather than having multiple
declarations in C files, now following our coding style.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
* Also updated by the signal handler (consumer_should_exit()). Read by the
* polling threads.
*/
* Also updated by the signal handler (consumer_should_exit()). Read by the
* polling threads.
*/
-volatile int consumer_quit;
/*
* Global hash table containing respectively metadata and data streams. The
/*
* Global hash table containing respectively metadata and data streams. The
+ CMM_STORE_SHARED(consumer_quit, 1);
ret = lttng_write(ctx->consumer_should_quit[1], "4", 1);
if (ret < 1) {
PERROR("write consumer quit");
ret = lttng_write(ctx->consumer_should_quit[1], "4", 1);
if (ret < 1) {
PERROR("write consumer quit");
pthread_mutex_unlock(&consumer_data.lock);
/* No FDs and consumer_quit, consumer_cleanup the thread */
pthread_mutex_unlock(&consumer_data.lock);
/* No FDs and consumer_quit, consumer_cleanup the thread */
- if (nb_fd == 0 && consumer_quit == 1) {
+ if (nb_fd == 0 && CMM_LOAD_SHARED(consumer_quit) == 1) {
err = 0; /* All is OK */
goto end;
}
err = 0; /* All is OK */
goto end;
}
+ if (CMM_LOAD_SHARED(consumer_quit)) {
DBG("consumer_thread_receive_fds received quit from signal");
err = 0; /* All is OK */
goto end;
DBG("consumer_thread_receive_fds received quit from signal");
err = 0; /* All is OK */
goto end;
* when all fds have hung up, the polling thread
* can exit cleanly
*/
* when all fds have hung up, the polling thread
* can exit cleanly
*/
+ CMM_STORE_SHARED(consumer_quit, 1);
/*
* Notify the data poll thread to poll back again and test the
/*
* Notify the data poll thread to poll back again and test the
struct lttng_ht *stream_per_chan_id_ht;
};
struct lttng_ht *stream_per_chan_id_ht;
};
+/*
+ * Set to nonzero when the consumer is exiting. Updated by signal
+ * handler and thread exit, read by threads.
+ */
+extern int consumer_quit;
+
/* Flag used to temporarily pause data consumption from testpoints. */
extern int data_consumption_paused;
/* Flag used to temporarily pause data consumption from testpoints. */
extern int data_consumption_paused;
extern struct lttng_consumer_global_data consumer_data;
extern int consumer_poll_timeout;
extern struct lttng_consumer_global_data consumer_data;
extern int consumer_poll_timeout;
-extern volatile int consumer_quit;
/*
* Take a snapshot for a specific fd
/*
* Take a snapshot for a specific fd
extern struct lttng_consumer_global_data consumer_data;
extern int consumer_poll_timeout;
extern struct lttng_consumer_global_data consumer_data;
extern int consumer_poll_timeout;
-extern volatile int consumer_quit;
/*
* Free channel object and all streams associated with it. This MUST be used
/*
* Free channel object and all streams associated with it. This MUST be used