aboutsummaryrefslogtreecommitdiff
path: root/include/odp/api/spec/thread.h
blob: 125e7a117d164a9c660744d39c5ab171291d477e (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* Copyright (c) 2013, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */


/**
 * @file
 *
 * ODP thread API
 */

#ifndef ODP_API_SPEC_THREAD_H_
#define ODP_API_SPEC_THREAD_H_
#include <odp/visibility_begin.h>

#ifdef __cplusplus
extern "C" {
#endif

/** @defgroup odp_thread ODP THREAD
 *  @{
 */

/**
 * @def ODP_THREAD_COUNT_MAX
 * Maximum number of threads supported in build time. Use
 * odp_thread_count_max() for maximum number of threads supported in run time,
 * which depend on system configuration and may be lower than this number.
 */

/**
 * Get thread identifier
 *
 * Returns the thread identifier of the current thread. Thread ids range from 0
 * to odp_thread_count_max() - 1. The ODP thread id is assigned by
 * odp_init_local() and freed by odp_term_local(). Thread id is unique within
 * the ODP instance.
 *
 * @return Thread identifier of the current thread
 */
int odp_thread_id(void);

/**
 * Thread count
 *
 * Returns the current ODP thread count. This is the number of active threads
 * running the ODP instance. Each odp_init_local() call increments and each
 * odp_term_local() call decrements the count. The count is always between 1 and
 * odp_thread_count_max().
 *
 * @return Current thread count
 */
int odp_thread_count(void);

/**
 * Maximum thread count
 *
 * Returns the maximum thread count, which is a constant value and set in
 * ODP initialization phase. This may be lower than ODP_THREAD_COUNT_MAX.
 *
 * @return Maximum thread count
 */
int odp_thread_count_max(void);

/**
 * Thread type
 *
 * Returns the thread type of the current thread.
 *
 * @return Thread type
 */
odp_thread_type_t odp_thread_type(void);


/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#include <odp/visibility_end.h>
#endif