-
Notifications
You must be signed in to change notification settings - Fork 0
/
threadname.h
55 lines (47 loc) · 1.2 KB
/
threadname.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef THREADNAME_H
#define THREADNAME_H
#ifdef __cplusplus
extern "C" {
#endif
/** @file */
// size of thread name, including terminating null
#define THREADNAME_SIZE 16
__attribute__((nonnull, access(write_only, 1, 2)))
/**
* @brief Get current thread name.
*
* @param[out] buf Buffer to store thread name.
* @param size Size of buffer.
* @return 0 on success, error otherwise.
*/
int threadname_get (char *buf, int size);
__attribute__((nonnull, access(read_only, 1)))
/**
* @brief Set current thread name.
*
* @param name Thread name.
* @return 0 on success, error otherwise.
*/
int threadname_set (const char *name);
__attribute__((nonnull, access(read_only, 1)))
/**
* @brief Set current thread name.
*
* @param format Format string.
* @param ... Format arguments.
* @return 0 on success, error otherwise.
*/
int threadname_format (const char *format, ...);
__attribute__((nonnull, access(read_only, 1), format(printf, 1, 2)))
/**
* @brief Append string to current thread name.
*
* @param format Format string.
* @param ... Format arguments.
* @return 0 on success, error otherwise.
*/
int threadname_append (const char *format, ...);
#ifdef __cplusplus
}
#endif
#endif /* THREADNAME_H */