From: Yan Sonming <[email protected]>

Signed-off-by: Yan Sonming <[email protected]>
Signed-off-by: Mike Holmes <[email protected]>
---
 platform/linux-generic/include/odp_internal.h |  1 +
 platform/linux-generic/odp_init.c             |  5 +++++
 platform/linux-generic/odp_schedule.c         | 25 +++++++++++++++++++++++++
 3 files changed, 31 insertions(+)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 0120c53..d244c75 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -53,6 +53,7 @@ int odp_crypto_init_global(void);
 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_timer_init_global(void);
diff --git a/platform/linux-generic/odp_init.c 
b/platform/linux-generic/odp_init.c
index cdce239..2788e46 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -91,6 +91,11 @@ int odp_term_global(void)
                return -1;
        }
 
+       if (odp_schedule_term_global()) {
+               ODP_ERR("ODP schedule term failed.\n");
+               return -1;
+       }
+
        return 0;
 }
 
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 3427082..be5149b 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -144,6 +144,31 @@ int odp_schedule_init_global(void)
        return 0;
 }
 
+int odp_schedule_term_global(void)
+{
+       odp_shm_t shm;
+       int ret = 0;
+       int i, j;
+
+       for (i = 0; i < ODP_CONFIG_SCHED_PRIOS; i++) {
+               for (j = 0; j < QUEUES_PER_PRIO; j++)
+                       odp_queue_destroy(sched->pri_queue[i][j]);
+       }
+
+       if (odp_pool_destroy(sched->pool) != 0) {
+               ODP_ERR("Sched term: Pool destroy fail.\n");
+               return -1;
+       }
+
+       shm = odp_shm_lookup("odp_scheduler");
+       if (shm == ODP_SHM_INVALID) {
+               ODP_ERR("Sched term: Shm lookup fail.\n");
+               return -1;
+       }
+       ret = odp_shm_free(shm);
+
+       return ret;
+}
 
 int odp_schedule_init_local(void)
 {
-- 
2.1.0


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to