summaryrefslogtreecommitdiff
path: root/core/nds32/task.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/nds32/task.c')
-rw-r--r--core/nds32/task.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/nds32/task.c b/core/nds32/task.c
index 6c0766635f..f4446bdacb 100644
--- a/core/nds32/task.c
+++ b/core/nds32/task.c
@@ -236,7 +236,8 @@ task_id_t task_get_current(void)
/* If we haven't done a context switch then our task ID isn't valid */
ASSERT(current_task != (task_ *)scratchpad);
#endif
- return current_task - tasks;
+ /* return invalid task id if task scheduling is not yet start */
+ return start_called ? (current_task - tasks) : TASK_ID_INVALID;
}
uint32_t *task_get_event_bitmap(task_id_t tskid)