diff mbox

[v2,07/10] linux-generic: thread: add term_global

Message ID 1424116520-20381-8-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes Feb. 16, 2015, 7:55 p.m. UTC
From: Yan Sonming <yan.songming@linaro.org>

Signed-off-by: Yan Songming <yan.songming@linaro.org>
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/include/odp_internal.h |  1 +
 platform/linux-generic/odp_init.c             |  5 +++++
 platform/linux-generic/odp_thread.c           | 13 +++++++++++++
 3 files changed, 19 insertions(+)
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index 59c65e2..d0cd085 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -34,6 +34,7 @@  int odp_system_info_init(void);
 int odp_thread_init_global(void);
 int odp_thread_init_local(void);
 int odp_thread_term_local(void);
+int odp_thread_term_global(void);
 
 int odp_shm_init_global(void);
 int odp_shm_init_local(void);
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index 58faa59..9141b56 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -106,6 +106,11 @@  int odp_term_global(void)
 		return -1;
 	}
 
+	if (odp_thread_term_global()) {
+		ODP_ERR("ODP thread term failed.\n");
+		return -1;
+	}
+
 	return 0;
 }
 
diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c
index f6c900b..1f483a1 100644
--- a/platform/linux-generic/odp_thread.c
+++ b/platform/linux-generic/odp_thread.c
@@ -65,6 +65,19 @@  int odp_thread_init_global(void)
 	return 0;
 }
 
+int odp_thread_term_global(void)
+{
+	odp_shm_t shm;
+	int ret = 0;
+
+	shm = odp_shm_lookup("odp_thread_globals");
+	if (shm == ODP_SHM_INVALID)
+		return -1;
+	ret = odp_shm_free(shm);
+
+	return ret;
+}
+
 
 static int thread_id(void)
 {