#include "notification-thread.h"
#include "notification-thread-commands.h"
#include <common/error.h>
-#include <common/futex.h>
#include <unistd.h>
#include <stdint.h>
#include <inttypes.h>
{
memset(cmd, 0, sizeof(*cmd));
CDS_INIT_LIST_HEAD(&cmd->cmd_list_node);
+ lttng_waiter_init(&cmd->reply_waiter);
}
static
int ret;
uint64_t notification_counter = 1;
- futex_nto1_prepare(&cmd->reply_futex);
-
pthread_mutex_lock(&handle->cmd_queue.lock);
/* Add to queue. */
cds_list_add_tail(&cmd->cmd_list_node,
}
pthread_mutex_unlock(&handle->cmd_queue.lock);
- futex_nto1_wait(&cmd->reply_futex);
+ lttng_waiter_wait(&cmd->reply_waiter);
return 0;
error_unlock_queue:
pthread_mutex_unlock(&handle->cmd_queue.lock);
#include <lttng/lttng-error.h>
#include <urcu/rculfhash.h>
#include "notification-thread.h"
+#include <common/waiter.h>
struct notification_thread_data;
struct lttng_trigger;
} remove_channel;
} parameters;
- /* Futex on which to wait for command reply (optional). */
- int32_t reply_futex;
+ /* lttng_waiter on which to wait for command reply (optional). */
+ struct lttng_waiter reply_waiter;
enum lttng_error_code reply_code;
};
}
end:
cds_list_del(&cmd->cmd_list_node);
- futex_nto1_wake(&cmd->reply_futex);
+ lttng_waiter_wake_up(&cmd->reply_waiter);
pthread_mutex_unlock(&handle->cmd_queue.lock);
return ret;
error_unlock:
/* Wake-up and return a fatal error to the calling thread. */
- futex_nto1_wake(&cmd->reply_futex);
+ lttng_waiter_wake_up(&cmd->reply_waiter);
pthread_mutex_unlock(&handle->cmd_queue.lock);
cmd->reply_code = LTTNG_ERR_FATAL;
error:
#include <common/config/session-config.h>
#include <common/defaults.h>
#include <common/utils.h>
-#include <common/futex.h>
#include <common/align.h>
#include <common/time.h>
#include <sys/eventfd.h>
struct notification_thread_handle *handle)
{
int ret;
- struct notification_thread_command *cmd, *tmp;
if (!handle) {
goto end;
PERROR("close notification command queue event_fd");
}
- pthread_mutex_lock(&handle->cmd_queue.lock);
- /* Purge queue of in-flight commands and mark them as cancelled. */
- cds_list_for_each_entry_safe(cmd, tmp, &handle->cmd_queue.list,
- cmd_list_node) {
- cds_list_del(&cmd->cmd_list_node);
- cmd->reply_code = LTTNG_ERR_COMMAND_CANCELLED;
- futex_nto1_wake(&cmd->reply_futex);
- }
- pthread_mutex_unlock(&handle->cmd_queue.lock);
+ assert(cds_list_empty(&handle->cmd_queue.list));
pthread_mutex_destroy(&handle->cmd_queue.lock);
if (handle->channel_monitoring_pipes.ust32_consumer >= 0) {