diff mbox

[09/10] linux-generic: schedule: add term_local

Message ID 1422586015-29874-10-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes Jan. 30, 2015, 2:46 a.m. UTC
From: Yan Sonming <yan.songming@linaro.org>

Signed-off-by: Yan Sonming <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_schedule.c         | 6 ++++++
 3 files changed, 12 insertions(+)
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index 5b81570..8c6b0b0 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -54,6 +54,7 @@  int odp_crypto_term_global(void);
 int odp_schedule_init_global(void);
 int odp_schedule_term_global(void);
 int odp_schedule_init_local(void);
+int odp_schedule_term_local(void);
 
 int odp_timer_init_global(void);
 int odp_timer_disarm_all(void);
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index 8e61368..3724fac 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -142,5 +142,10 @@  int odp_init_local(void)
 
 int odp_term_local(void)
 {
+	if (odp_schedule_term_local()) {
+		ODP_ERR("ODP schedule local term failed.\n");
+		return -1;
+	}
+
 	return (odp_thread_term_local() > 0) ? 1 : 0;
 }
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index 32dcf50..c72b998 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -4,6 +4,7 @@ 
  * SPDX-License-Identifier:     BSD-3-Clause
  */
 
+#include <string.h>
 #include <odp/schedule.h>
 #include <odp_schedule_internal.h>
 #include <odp/align.h>
@@ -188,6 +189,11 @@  int odp_schedule_init_local(void)
 	return 0;
 }
 
+int odp_schedule_term_local(void)
+{
+	memset(&sched_local, 0, sizeof(sched_local_t));
+	return 0;
+}
 
 void odp_schedule_mask_set(odp_queue_t queue, int prio)
 {