diff mbox

[01/11] api: thread: added thread type

Message ID 1436449585-23252-2-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit b16afd47225ed07360bd7574ed1970ff544c5d50
Headers show

Commit Message

Maxim Uvarov July 9, 2015, 1:46 p.m. UTC
From: Petri Savolainen <petri.savolainen@nokia.com>

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>
---
 include/odp/api/thread.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
diff mbox

Patch

diff --git a/include/odp/api/thread.h b/include/odp/api/thread.h
index a509ef9..89eae2b 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);
+
+
+/**
  * @}
  */