*/
#include "thread.hpp"
+
+#include <common/defaults.hpp>
+#include <common/error.hpp>
+#include <common/macros.hpp>
+
+#include <pthread.h>
#include <urcu/list.h>
#include <urcu/ref.h>
-#include <pthread.h>
-#include <common/macros.hpp>
-#include <common/error.hpp>
-#include <common/defaults.hpp>
namespace {
struct thread_list {
void *data;
};
-static
-void lttng_thread_destroy(struct lttng_thread *thread)
+static void lttng_thread_destroy(struct lttng_thread *thread)
{
if (thread->cleanup) {
thread->cleanup(thread->data);
free(thread);
}
-static
-void lttng_thread_release(struct urcu_ref *ref)
+static void lttng_thread_release(struct urcu_ref *ref)
{
- lttng_thread_destroy(container_of(ref, struct lttng_thread, ref));
+ lttng_thread_destroy(lttng::utils::container_of(ref, <tng_thread::ref));
}
-static
-void *launch_thread(void *data)
+static void *launch_thread(void *data)
{
void *ret;
struct lttng_thread *thread = (struct lttng_thread *) data;
}
struct lttng_thread *lttng_thread_create(const char *name,
- lttng_thread_entry_point entry,
- lttng_thread_shutdown_cb shutdown,
- lttng_thread_cleanup_cb cleanup,
- void *thread_data)
+ lttng_thread_entry_point entry,
+ lttng_thread_shutdown_cb shutdown,
+ lttng_thread_cleanup_cb cleanup,
+ void *thread_data)
{
int ret;
struct lttng_thread *thread;
cds_list_add(&thread->node, &thread_list.head);
(void) lttng_thread_get(thread);
- ret = pthread_create(&thread->thread, default_pthread_attr(),
- launch_thread, thread);
+ ret = pthread_create(&thread->thread, default_pthread_attr(), launch_thread, thread);
if (ret) {
PERROR("Failed to create \"%s\" thread", thread->name);
goto error_pthread_create;
return thread->name;
}
-static
-bool _lttng_thread_shutdown(struct lttng_thread *thread)
+static bool _lttng_thread_shutdown(struct lttng_thread *thread)
{
int ret;
void *status;
struct lttng_thread *thread, *tmp;
pthread_mutex_lock(&thread_list.lock);
- cds_list_for_each_entry_safe(thread, tmp, &thread_list.head, node) {
+ cds_list_for_each_entry_safe (thread, tmp, &thread_list.head, node) {
bool result;
const long ref = uatomic_read(&thread->ref.refcount);