summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/idle.c2
-rw-r--r--src/ipc.c36
-rw-r--r--src/mem.c2
-rw-r--r--src/memheap.c2
-rw-r--r--src/scheduler_mp.c14
-rw-r--r--src/scheduler_up.c14
-rw-r--r--src/thread.c10
7 files changed, 39 insertions, 41 deletions
diff --git a/src/idle.c b/src/idle.c
index dcd278c628..4903ed3fe5 100644
--- a/src/idle.c
+++ b/src/idle.c
@@ -207,7 +207,7 @@ static void rt_defunct_execute(void)
break;
}
#ifdef RT_USING_MODULE
- module = (struct rt_dlmodule*)thread->module_id;
+ module = (struct rt_dlmodule*)thread->parent.module_id;
if (module)
{
dlmodule_destroy(module);
diff --git a/src/ipc.c b/src/ipc.c
index be220439b8..3bd94b5b1b 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -209,7 +209,7 @@ rt_inline rt_err_t _ipc_list_resume(rt_list_t *list)
thread->error = RT_EOK;
- RT_DEBUG_LOG(RT_DEBUG_IPC, ("resume thread:%s\n", thread->name));
+ RT_DEBUG_LOG(RT_DEBUG_IPC, ("resume thread:%s\n", thread->parent.name));
/* resume it */
rt_thread_resume(thread);
@@ -509,8 +509,8 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag)
level = rt_hw_interrupt_disable();
RT_DEBUG_LOG(RT_DEBUG_IPC, ("thread %s take sem:%s, which value is: %d\n",
- rt_thread_self()->name,
- ((struct rt_object *)sem)->name,
+ rt_thread_self()->parent.name,
+ sem->parent.parent.name,
sem->value));
if (sem->value > 0)
@@ -542,8 +542,7 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag)
/* reset thread error number */
thread->error = -RT_EINTR;
- RT_DEBUG_LOG(RT_DEBUG_IPC, ("sem take: suspend thread - %s\n",
- thread->name));
+ RT_DEBUG_LOG(RT_DEBUG_IPC, ("sem take: suspend thread - %s\n", thread->parent.name));
/* suspend thread */
ret = _ipc_list_suspend(&(sem->parent.suspend_thread),
@@ -559,8 +558,7 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag)
/* has waiting time, start thread timer */
if (timeout > 0)
{
- RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n",
- thread->name));
+ RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n", thread->parent.name));
/* reset the timeout of thread timer and start it */
rt_timer_control(&(thread->thread_timer),
@@ -655,8 +653,8 @@ rt_err_t rt_sem_release(rt_sem_t sem)
level = rt_hw_interrupt_disable();
RT_DEBUG_LOG(RT_DEBUG_IPC, ("thread %s releases sem:%s, which value is: %d\n",
- rt_thread_self()->name,
- ((struct rt_object *)sem)->name,
+ rt_thread_self()->parent.name,
+ sem->parent.parent.name,
sem->value));
if (!rt_list_isempty(&sem->parent.suspend_thread))
@@ -789,7 +787,7 @@ rt_inline void _thread_update_priority(struct rt_thread *thread, rt_uint8_t prio
{
rt_err_t ret;
RT_DEBUG_LOG(RT_DEBUG_IPC,
- ("thread:%s priority -> %d\n", thread->name, priority));
+ ("thread:%s priority -> %d\n", thread->parent.name, priority));
/* change priority of the thread */
rt_thread_control(thread,
@@ -1182,7 +1180,7 @@ static rt_err_t _rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout, int suspend
RT_DEBUG_LOG(RT_DEBUG_IPC,
("mutex_take: current thread %s, hold: %d\n",
- thread->name, mutex->hold));
+ thread->parent.name, mutex->hold));
/* reset thread error */
thread->error = RT_EOK;
@@ -1239,7 +1237,7 @@ static rt_err_t _rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout, int suspend
/* mutex is unavailable, push to suspend list */
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mutex_take: suspend thread: %s\n",
- thread->name));
+ thread->parent.name));
/* suspend current thread */
ret = _ipc_list_suspend(&(mutex->parent.suspend_thread),
@@ -1270,7 +1268,7 @@ static rt_err_t _rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout, int suspend
{
RT_DEBUG_LOG(RT_DEBUG_IPC,
("mutex_take: start the timer of thread:%s\n",
- thread->name));
+ thread->parent.name));
/* reset the timeout of thread timer and start it */
rt_timer_control(&(thread->thread_timer),
@@ -1424,7 +1422,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
RT_DEBUG_LOG(RT_DEBUG_IPC,
("mutex_release:current thread %s, hold: %d\n",
- thread->name, mutex->hold));
+ thread->parent.name, mutex->hold));
RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(mutex->parent.parent)));
@@ -1471,7 +1469,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
tlist);
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mutex_release: resume thread: %s\n",
- next_thread->name));
+ next_thread->parent.name));
/* remove the thread from the suspended list of mutex */
rt_list_remove(&(next_thread->tlist));
@@ -2418,7 +2416,7 @@ static rt_err_t _rt_mb_send_wait(rt_mailbox_t mb,
tick_delta = rt_tick_get();
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mb_send_wait: start timer of thread:%s\n",
- thread->name));
+ thread->parent.name));
/* reset the timeout of thread timer and start it */
rt_timer_control(&(thread->thread_timer),
@@ -2712,7 +2710,7 @@ static rt_err_t _rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeo
tick_delta = rt_tick_get();
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mb_recv: start timer of thread:%s\n",
- thread->name));
+ thread->parent.name));
/* reset the timeout of thread timer and start it */
rt_timer_control(&(thread->thread_timer),
@@ -3259,7 +3257,7 @@ static rt_err_t _rt_mq_send_wait(rt_mq_t mq,
tick_delta = rt_tick_get();
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mq_send_wait: start timer of thread:%s\n",
- thread->name));
+ thread->parent.name));
/* reset the timeout of thread timer and start it */
rt_timer_control(&(thread->thread_timer),
@@ -3614,7 +3612,7 @@ static rt_err_t _rt_mq_recv(rt_mq_t mq,
tick_delta = rt_tick_get();
RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n",
- thread->name));
+ thread->parent.name));
/* reset the timeout of thread timer and start it */
rt_timer_control(&(thread->thread_timer),
diff --git a/src/mem.c b/src/mem.c
index aade0f5bfa..79affcaa9b 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -375,7 +375,7 @@ void *rt_smem_alloc(rt_smem_t m, rt_size_t size)
mem->pool_ptr = MEM_USED();
#ifdef RT_USING_MEMTRACE
if (rt_thread_self())
- rt_smem_setname(mem, rt_thread_self()->name);
+ rt_smem_setname(mem, rt_thread_self()->parent.name);
else
rt_smem_setname(mem, "NONE");
#endif /* RT_USING_MEMTRACE */
diff --git a/src/memheap.c b/src/memheap.c
index 26d7ecfa3e..0df9ed41ed 100644
--- a/src/memheap.c
+++ b/src/memheap.c
@@ -312,7 +312,7 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size)
#ifdef RT_USING_MEMTRACE
if (rt_thread_self())
- rt_memcpy(header_ptr->owner_thread_name, rt_thread_self()->name, sizeof(header_ptr->owner_thread_name));
+ rt_memcpy(header_ptr->owner_thread_name, rt_thread_self()->parent.name, sizeof(header_ptr->owner_thread_name));
else
rt_memcpy(header_ptr->owner_thread_name, "NONE", sizeof(header_ptr->owner_thread_name));
#endif /* RT_USING_MEMTRACE */
diff --git a/src/scheduler_mp.c b/src/scheduler_mp.c
index a4d07e6233..543d9abc6a 100644
--- a/src/scheduler_mp.c
+++ b/src/scheduler_mp.c
@@ -112,7 +112,7 @@ static void _scheduler_stack_check(struct rt_thread *thread)
{
rt_base_t level;
- rt_kprintf("thread:%s stack overflow\n", thread->name);
+ rt_kprintf("thread:%s stack overflow\n", thread->parent.name);
level = rt_hw_interrupt_disable();
while (level);
@@ -121,13 +121,13 @@ static void _scheduler_stack_check(struct rt_thread *thread)
else if ((rt_ubase_t)thread->sp > ((rt_ubase_t)thread->stack_addr + thread->stack_size))
{
rt_kprintf("warning: %s stack is close to the top of stack address.\n",
- thread->name);
+ thread->parent.name);
}
#else
else if ((rt_ubase_t)thread->sp <= ((rt_ubase_t)thread->stack_addr + 32))
{
rt_kprintf("warning: %s stack is close to end of stack address.\n",
- thread->name);
+ thread->parent.name);
}
#endif /* ARCH_CPU_STACK_GROWS_UPWARD */
}
@@ -349,8 +349,8 @@ void rt_schedule(void)
"thread:%.*s(sp:0x%08x), "
"from thread:%.*s(sp: 0x%08x)\n",
pcpu->irq_nest, highest_ready_priority,
- RT_NAME_MAX, to_thread->name, to_thread->sp,
- RT_NAME_MAX, current_thread->name, current_thread->sp));
+ RT_NAME_MAX, to_thread->parent.name, to_thread->sp,
+ RT_NAME_MAX, current_thread->parent.name, current_thread->sp));
#ifdef RT_USING_OVERFLOW_CHECK
_scheduler_stack_check(to_thread);
@@ -584,7 +584,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
}
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("insert thread[%.*s], the priority: %d\n",
- RT_NAME_MAX, thread->name, thread->current_priority));
+ RT_NAME_MAX, thread->parent.name, thread->current_priority));
__exit:
/* enable interrupt */
@@ -608,7 +608,7 @@ void rt_schedule_remove_thread(struct rt_thread *thread)
level = rt_hw_interrupt_disable();
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("remove thread[%.*s], the priority: %d\n",
- RT_NAME_MAX, thread->name,
+ RT_NAME_MAX, thread->parent.name,
thread->current_priority));
/* remove thread from ready list */
diff --git a/src/scheduler_up.c b/src/scheduler_up.c
index a5cfecc6f2..6c552c6a24 100644
--- a/src/scheduler_up.c
+++ b/src/scheduler_up.c
@@ -117,7 +117,7 @@ static void _scheduler_stack_check(struct rt_thread *thread)
{
rt_base_t level;
- rt_kprintf("thread:%s stack overflow\n", thread->name);
+ rt_kprintf("thread:%s stack overflow\n", thread->parent.name);
level = rt_hw_interrupt_disable();
while (level);
@@ -126,13 +126,13 @@ static void _scheduler_stack_check(struct rt_thread *thread)
else if ((rt_ubase_t)thread->sp > ((rt_ubase_t)thread->stack_addr + thread->stack_size))
{
rt_kprintf("warning: %s stack is close to the top of stack address.\n",
- thread->name);
+ thread->parent.name);
}
#else
else if ((rt_ubase_t)thread->sp <= ((rt_ubase_t)thread->stack_addr + 32))
{
rt_kprintf("warning: %s stack is close to end of stack address.\n",
- thread->name);
+ thread->parent.name);
}
#endif /* ARCH_CPU_STACK_GROWS_UPWARD */
}
@@ -281,8 +281,8 @@ void rt_schedule(void)
"thread:%.*s(sp:0x%08x), "
"from thread:%.*s(sp: 0x%08x)\n",
rt_interrupt_nest, highest_ready_priority,
- RT_NAME_MAX, to_thread->name, to_thread->sp,
- RT_NAME_MAX, from_thread->name, from_thread->sp));
+ RT_NAME_MAX, to_thread->parent.name, to_thread->sp,
+ RT_NAME_MAX, from_thread->parent.name, from_thread->sp));
#ifdef RT_USING_OVERFLOW_CHECK
_scheduler_stack_check(to_thread);
@@ -384,7 +384,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
}
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("insert thread[%.*s], the priority: %d\n",
- RT_NAME_MAX, thread->name, thread->current_priority));
+ RT_NAME_MAX, thread->parent.name, thread->current_priority));
/* set priority mask */
#if RT_THREAD_PRIORITY_MAX > 32
@@ -414,7 +414,7 @@ void rt_schedule_remove_thread(struct rt_thread *thread)
level = rt_hw_interrupt_disable();
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("remove thread[%.*s], the priority: %d\n",
- RT_NAME_MAX, thread->name,
+ RT_NAME_MAX, thread->parent.name,
thread->current_priority));
/* remove thread from ready list */
diff --git a/src/thread.c b/src/thread.c
index 5614edea4d..56f9094ab0 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -237,7 +237,7 @@ static rt_err_t _thread_init(struct rt_thread *thread,
/* initialize thread timer */
rt_timer_init(&(thread->thread_timer),
- thread->name,
+ thread->parent.name,
_thread_timeout,
thread,
0,
@@ -274,7 +274,7 @@ static rt_err_t _thread_init(struct rt_thread *thread,
#endif /* RT_USING_PTHREADS */
#ifdef RT_USING_MODULE
- thread->module_id = 0;
+ thread->parent.module_id = 0;
#endif /* RT_USING_MODULE */
RT_OBJECT_HOOK_CALL(rt_thread_inited_hook, (thread));
@@ -386,7 +386,7 @@ rt_err_t rt_thread_startup(rt_thread_t thread)
#endif /* RT_THREAD_PRIORITY_MAX > 32 */
RT_DEBUG_LOG(RT_DEBUG_THREAD, ("startup a thread:%s with priority:%d\n",
- thread->name, thread->current_priority));
+ thread->parent.name, thread->current_priority));
/* change thread stat */
thread->stat = RT_THREAD_SUSPEND;
/* then resume it */
@@ -983,7 +983,7 @@ rt_err_t rt_thread_suspend_with_flag(rt_thread_t thread, int suspend_flag)
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
RT_ASSERT(thread == rt_thread_self());
- RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread suspend: %s\n", thread->name));
+ RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread suspend: %s\n", thread->parent.name));
stat = thread->stat & RT_THREAD_STAT_MASK;
if ((stat != RT_THREAD_READY) && (stat != RT_THREAD_RUNNING))
@@ -1046,7 +1046,7 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
RT_ASSERT(thread != RT_NULL);
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
- RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread resume: %s\n", thread->name));
+ RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread resume: %s\n", thread->parent.name));
if ((thread->stat & RT_THREAD_SUSPEND_MASK) != RT_THREAD_SUSPEND_MASK)
{