aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2015-07-09 16:46:15 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2015-07-23 19:21:51 +0300
commitb16afd47225ed07360bd7574ed1970ff544c5d50 (patch)
tree1b863cb5b34ba606dbdfd84aaa5cdfebc0e913e1
parent4bce2d9d8fd05bb2c2c0146070bb31c0bb7846d2 (diff)
api: thread: added thread type
Two thread types are defined: worker and control threads. API calls from a worker thread should be throughput and latency optimized, while the second one is not so sensitive to call overheads and latency. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--include/odp/api/thread.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/odp/api/thread.h b/include/odp/api/thread.h
index a509ef907..89eae2bc5 100644
--- a/include/odp/api/thread.h
+++ b/include/odp/api/thread.h
@@ -23,6 +23,34 @@ extern "C" {
*/
/**
+ * Thread type
+ */
+typedef enum odp_thread_type_e {
+ /**
+ * Worker thread
+ *
+ * Worker threads do most part of ODP application packet processing.
+ * These threads provide high packet and data rates, with low and
+ * predictable latency. Typically, worker threads are pinned to isolated
+ * CPUs and packets are processed in a run-to-completion loop with very
+ * low interference from the operating system.
+ */
+ ODP_THREAD_WORKER = 0,
+
+ /**
+ * Control thread
+ *
+ * Control threads do not participate the main packet flow through the
+ * system, but e.g. control or monitor the worker threads, or handle
+ * exceptions. These threads may perform general purpose processing,
+ * use system calls, share the CPU with other threads and be interrupt
+ * driven.
+ */
+ ODP_THREAD_CONTROL
+} odp_thread_type_t;
+
+
+/**
* Get thread identifier
*
* Returns the thread identifier of the current thread. Thread ids range from 0
@@ -47,6 +75,16 @@ int odp_thread_id(void);
int odp_thread_count(void);
/**
+ * Thread type
+ *
+ * Returns the thread type of the current thread.
+ *
+ * @return Thread type
+ */
+odp_thread_type_t odp_thread_type(void);
+
+
+/**
* @}
*/