sessiond: tsdl: remove useless std::move
[lttng-tools.git] / src / bin / lttng-sessiond / thread.hpp
CommitLineData
b878f05a 1/*
ab5be9fa 2 * Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com>
b878f05a 3 *
ab5be9fa 4 * SPDX-License-Identifier: GPL-2.0-only
b878f05a 5 *
b878f05a
JG
6 */
7
8#include <stdbool.h>
9
10#ifndef THREAD_H
11#define THREAD_H
12
13struct lttng_thread;
14
15/* Main function of the new thread. */
16typedef void *(*lttng_thread_entry_point)(void *);
17
18/* Callback invoked to initiate the shutdown a thread. */
19typedef bool (*lttng_thread_shutdown_cb)(void *);
20
21/*
22 * Callback invoked to clean-up the thread data.
23 * Invoked when the thread is destroyed to ensure there is no
24 * race between a use by the "thread shutdown callback" and
25 * a use by the thread itself.
26 */
27typedef void (*lttng_thread_cleanup_cb)(void *);
28
29/*
30 * Returns a reference to the newly-created thread.
31 * The shutdown and cleanup callbacks are optional.
32 */
33struct lttng_thread *lttng_thread_create(const char *name,
34 lttng_thread_entry_point entry,
35 lttng_thread_shutdown_cb shutdown,
36 lttng_thread_cleanup_cb cleanup,
37 void *thread_data);
38
39bool lttng_thread_get(struct lttng_thread *thread);
40void lttng_thread_put(struct lttng_thread *thread);
41
42const char *lttng_thread_get_name(const struct lttng_thread *thread);
43
44/*
45 * Explicitly shutdown a thread. This function returns once the
46 * thread has returned and been joined.
47 *
48 * It is invalid to call this function more than once on a thread.
49 *
50 * Returns true on success, false on error.
51 */
52bool lttng_thread_shutdown(struct lttng_thread *thread);
53
54/*
55 * Shutdown all orphaned threads (threads to which no external reference
56 * exist).
57 *
58 * Returns once all orphaned threads have been joined.
59 */
60void lttng_thread_list_shutdown_orphans(void);
61
62#endif /* THREAD_H */
This page took 0.056247 seconds and 4 git commands to generate.