@@ -59,6 +59,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);
@@ -148,5 +148,22 @@ int odp_init_local(void)
int odp_term_local(void)
{
- return (odp_thread_term_local() > 0) ? 1 : 0;
+ int rc = 0;
+ int rc_thd = 0;
+
+ if (odp_schedule_term_local()) {
+ ODP_ERR("ODP schedule local term failed.\n");
+ rc = -1;
+ }
+
+ rc_thd = odp_thread_term_local();
+ if (rc_thd < 0) {
+ ODP_ERR("ODP thread local term failed.\n");
+ rc = -1;
+ } else {
+ if (!rc)
+ rc = rc_thd;
+ }
+
+ return rc;
}
@@ -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>
@@ -151,8 +152,12 @@ int odp_schedule_term_global(void)
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]);
+ for (j = 0; j < QUEUES_PER_PRIO; j++) {
+ if (odp_queue_destroy(sched->pri_queue[i][j])) {
+ ODP_ERR("Sched term: Queue destroy fail.\n");
+ rc = -1;
+ }
+ }
}
if (odp_pool_destroy(sched->pool) != 0) {
@@ -187,6 +192,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)
{