projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
.clang-tidy: remove modernize-concat-nested-namespaces
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
notification-thread-commands.cpp
diff --git
a/src/bin/lttng-sessiond/notification-thread-commands.cpp
b/src/bin/lttng-sessiond/notification-thread-commands.cpp
index a8d774a4f0764081e9d3203fd20fd49cea5fbaf8..2f275477b133e9c488d21beb38cdccbe6e516e6f 100644
(file)
--- a/
src/bin/lttng-sessiond/notification-thread-commands.cpp
+++ b/
src/bin/lttng-sessiond/notification-thread-commands.cpp
@@
-20,7
+20,6
@@
static void init_notification_thread_command(struct notification_thread_command *cmd)
{
CDS_INIT_LIST_HEAD(&cmd->cmd_list_node);
static void init_notification_thread_command(struct notification_thread_command *cmd)
{
CDS_INIT_LIST_HEAD(&cmd->cmd_list_node);
- lttng_waiter_init(&cmd->reply_waiter);
}
static int run_command_wait(struct notification_thread_handle *handle,
}
static int run_command_wait(struct notification_thread_handle *handle,
@@
-29,6
+28,9
@@
static int run_command_wait(struct notification_thread_handle *handle,
int ret;
uint64_t notification_counter = 1;
int ret;
uint64_t notification_counter = 1;
+ lttng::synchro::waiter command_completion_waiter;
+ cmd->command_completed_waker.emplace(command_completion_waiter.get_waker());
+
pthread_mutex_lock(&handle->cmd_queue.lock);
/* Add to queue. */
cds_list_add_tail(&cmd->cmd_list_node, &handle->cmd_queue.list);
pthread_mutex_lock(&handle->cmd_queue.lock);
/* Add to queue. */
cds_list_add_tail(&cmd->cmd_list_node, &handle->cmd_queue.list);
@@
-46,7
+48,8
@@
static int run_command_wait(struct notification_thread_handle *handle,
}
pthread_mutex_unlock(&handle->cmd_queue.lock);
}
pthread_mutex_unlock(&handle->cmd_queue.lock);
- lttng_waiter_wait(&cmd->reply_waiter);
+ command_completion_waiter.wait();
+ ;
return 0;
error_unlock_queue:
pthread_mutex_unlock(&handle->cmd_queue.lock);
return 0;
error_unlock_queue:
pthread_mutex_unlock(&handle->cmd_queue.lock);
@@
-58,14
+61,15
@@
notification_thread_command_copy(const struct notification_thread_command *origi
{
struct notification_thread_command *new_cmd;
{
struct notification_thread_command *new_cmd;
- new_cmd = zmalloc<notification_thread_command>();
- if (!new_cmd) {
- goto end;
+ try {
+ new_cmd = new notification_thread_command;
+ } catch (const std::bad_alloc& e) {
+ ERR("Failed to allocate notification_thread_command: %s", e.what());
+ return nullptr;
}
*new_cmd = *original_cmd;
init_notification_thread_command(new_cmd);
}
*new_cmd = *original_cmd;
init_notification_thread_command(new_cmd);
-end:
return new_cmd;
}
return new_cmd;
}
@@
-96,10
+100,12
@@
static int run_command_no_wait(struct notification_thread_handle *handle,
cds_list_del(&new_cmd->cmd_list_node);
goto error_unlock_queue;
}
cds_list_del(&new_cmd->cmd_list_node);
goto error_unlock_queue;
}
+
pthread_mutex_unlock(&handle->cmd_queue.lock);
return 0;
error_unlock_queue:
pthread_mutex_unlock(&handle->cmd_queue.lock);
return 0;
error_unlock_queue:
- free(new_cmd);
+
+ delete new_cmd;
pthread_mutex_unlock(&handle->cmd_queue.lock);
error:
return -1;
pthread_mutex_unlock(&handle->cmd_queue.lock);
error:
return -1;
@@
-112,7
+118,7
@@
notification_thread_command_register_trigger(struct notification_thread_handle *
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
LTTNG_ASSERT(trigger);
init_notification_thread_command(&cmd);
LTTNG_ASSERT(trigger);
init_notification_thread_command(&cmd);
@@
-138,7
+144,7
@@
notification_thread_command_unregister_trigger(struct notification_thread_handle
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
@@
-164,7
+170,7
@@
notification_thread_command_add_session(struct notification_thread_handle *handl
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
@@
-190,7
+196,7
@@
notification_thread_command_remove_session(struct notification_thread_handle *ha
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
@@
-217,7
+223,7
@@
notification_thread_command_add_channel(struct notification_thread_handle *handl
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
@@
-243,7
+249,7
@@
enum lttng_error_code notification_thread_command_remove_channel(
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
@@
-268,7
+274,7
@@
notification_thread_command_session_rotation_ongoing(struct notification_thread_
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
@@
-294,7
+300,7
@@
enum lttng_error_code notification_thread_command_session_rotation_completed(
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
@@
-320,7
+326,7
@@
notification_thread_command_add_tracer_event_source(struct notification_thread_h
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
LTTNG_ASSERT(tracer_event_source_fd >= 0);
LTTNG_ASSERT(tracer_event_source_fd >= 0);
@@
-347,7
+353,7
@@
notification_thread_command_remove_tracer_event_source(struct notification_threa
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
@@
-370,7
+376,7
@@
enum lttng_error_code notification_thread_command_list_triggers(
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
LTTNG_ASSERT(handle);
LTTNG_ASSERT(triggers);
LTTNG_ASSERT(handle);
LTTNG_ASSERT(triggers);
@@
-396,7
+402,7
@@
end:
void notification_thread_command_quit(struct notification_thread_handle *handle)
{
int ret;
void notification_thread_command_quit(struct notification_thread_handle *handle)
{
int ret;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
@@
-410,7
+416,7
@@
int notification_thread_client_communication_update(
notification_client_id id,
enum client_transmission_status transmission_status)
{
notification_client_id id,
enum client_transmission_status transmission_status)
{
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
@@
-427,7
+433,7
@@
notification_thread_command_get_trigger(struct notification_thread_handle *handl
{
int ret;
enum lttng_error_code ret_code;
{
int ret;
enum lttng_error_code ret_code;
-
struct notification_thread_command cmd = {}
;
+
notification_thread_command cmd
;
init_notification_thread_command(&cmd);
init_notification_thread_command(&cmd);
This page took
0.025456 seconds
and
4
git commands to generate.