Added maximum thread count define to enable static memory allocation.
The API call returns dynamic maximum. Static and dynamic may be different
application is build for binary compatibility.

Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
---
 include/odp/api/thread.h                           |  9 +++++-
 platform/linux-generic/Makefile.am                 |  1 +
 .../linux-generic/include/odp/plat/thread_types.h  | 34 ++++++++++++++++++++++
 platform/linux-generic/include/odp/thread.h        |  8 +----
 4 files changed, 44 insertions(+), 8 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/thread_types.h

diff --git a/include/odp/api/thread.h b/include/odp/api/thread.h
index 3029342..3720249 100644
--- a/include/odp/api/thread.h
+++ b/include/odp/api/thread.h
@@ -23,6 +23,13 @@ extern "C" {
  */
 
 /**
+ * @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.
+ */
+
+/**
  * Thread type
  */
 typedef enum odp_thread_type_e {
@@ -78,7 +85,7 @@ int odp_thread_count(void);
  * Maximum thread count
  *
  * Returns the maximum thread count, which is a constant value and set in
- * ODP initialization phase.
+ * ODP initialization phase. This may be lower than ODP_THREAD_COUNT_MAX.
  *
  * @return Maximum thread count
  */
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index a6b6029..ca372eb 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -74,6 +74,7 @@ odpplatinclude_HEADERS = \
                  $(srcdir)/include/odp/plat/spinlock_types.h \
                  $(srcdir)/include/odp/plat/spinlock_recursive_types.h \
                  $(srcdir)/include/odp/plat/strong_types.h \
+                 $(srcdir)/include/odp/plat/thread_types.h \
                  $(srcdir)/include/odp/plat/thrmask_types.h \
                  $(srcdir)/include/odp/plat/ticketlock_types.h \
                  $(srcdir)/include/odp/plat/time_types.h \
diff --git a/platform/linux-generic/include/odp/plat/thread_types.h 
b/platform/linux-generic/include/odp/plat/thread_types.h
new file mode 100644
index 0000000..33af459
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/thread_types.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP thread
+ */
+
+#ifndef ODP_THREAD_TYPES_H_
+#define ODP_THREAD_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup odp_thread
+ *  @{
+ */
+
+#define ODP_THREAD_COUNT_MAX 128
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/thread.h 
b/platform/linux-generic/include/odp/thread.h
index e521585..522ca25 100644
--- a/platform/linux-generic/include/odp/thread.h
+++ b/platform/linux-generic/include/odp/thread.h
@@ -17,13 +17,7 @@
 extern "C" {
 #endif
 
-/** @ingroup odp_thread ODP THREAD
- *  @{
- */
-
-/**
- * @}
- */
+#include <odp/plat/thread_types.h>
 
 #include <odp/api/thread.h>
 
-- 
2.6.2

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to