projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: leak of consumer_output when using an explicit snapshot output
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
thread-utils.c
diff --git
a/src/bin/lttng-sessiond/thread-utils.c
b/src/bin/lttng-sessiond/thread-utils.c
index 99b8298983fa6a7a8f489bcb7222a198b6d217dc..16ae9d69204a971b07ac6d2857a148df87d983bd 100644
(file)
--- a/
src/bin/lttng-sessiond/thread-utils.c
+++ b/
src/bin/lttng-sessiond/thread-utils.c
@@
-20,6
+20,7
@@
#include "lttng-sessiond.h"
#include "utils.h"
#include <common/utils.h>
#include "lttng-sessiond.h"
#include "utils.h"
#include <common/utils.h>
+#include <pthread.h>
/*
* Quit pipe for all threads. This permits a single cancellation point
/*
* Quit pipe for all threads. This permits a single cancellation point
@@
-67,6
+68,8
@@
int sessiond_check_thread_quit_pipe(int fd, uint32_t events)
/*
* Wait for a notification on the quit pipe (with a timeout).
*
/*
* Wait for a notification on the quit pipe (with a timeout).
*
+ * A timeout value of -1U means no timeout.
+ *
* Returns 1 if the caller should quit, 0 if the timeout was reached, and
* -1 if an error was encountered.
*/
* Returns 1 if the caller should quit, 0 if the timeout was reached, and
* -1 if an error was encountered.
*/
@@
-79,11
+82,12
@@
int sessiond_wait_for_quit_pipe(unsigned int timeout_us)
FD_ZERO(&read_fds);
FD_SET(thread_quit_pipe[0], &read_fds);
memset(&timeout, 0, sizeof(timeout));
FD_ZERO(&read_fds);
FD_SET(thread_quit_pipe[0], &read_fds);
memset(&timeout, 0, sizeof(timeout));
- timeout.tv_usec = timeout_us;
+ timeout.tv_sec = timeout_us / USEC_PER_SEC;
+ timeout.tv_usec = timeout_us % USEC_PER_SEC;
while (true) {
ret = select(thread_quit_pipe[0] + 1, &read_fds, NULL, NULL,
while (true) {
ret = select(thread_quit_pipe[0] + 1, &read_fds, NULL, NULL,
-
&timeout
);
+
timeout_us != -1U ? &timeout : NULL
);
if (ret < 0 && errno == EINTR) {
/* Retry on interrupt. */
continue;
if (ret < 0 && errno == EINTR) {
/* Retry on interrupt. */
continue;
This page took
0.025775 seconds
and
5
git commands to generate.