sessiond: clarify the role of notification credentials
[lttng-tools.git] / src / bin / lttng-sessiond / thread.h
1 /*
2 * Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #include <stdbool.h>
9
10 #ifndef THREAD_H
11 #define THREAD_H
12
13 struct lttng_thread;
14
15 /* Main function of the new thread. */
16 typedef void *(*lttng_thread_entry_point)(void *);
17
18 /* Callback invoked to initiate the shutdown a thread. */
19 typedef 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 */
27 typedef 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 */
33 struct 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
39 bool lttng_thread_get(struct lttng_thread *thread);
40 void lttng_thread_put(struct lttng_thread *thread);
41
42 const 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 */
52 bool 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 */
60 void lttng_thread_list_shutdown_orphans(void);
61
62 #endif /* THREAD_H */
This page took 0.029589 seconds and 4 git commands to generate.