fix bug in Thread.cpp/Thread.h/components.c files
This commit is contained in:
parent
5180262010
commit
85a9f5add9
|
@ -80,23 +80,23 @@ void Thread::func(Thread *pThis)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pThis->run();
|
pThis->run(pThis->_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
rt_event_send(&pThis->_event, 1);
|
rt_event_send(&pThis->_event, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::run()
|
void Thread::run(void *parameter)
|
||||||
{
|
{
|
||||||
/* please overload this method */
|
/* please overload this method */
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::wait(int32_t millisec)
|
rt_err_t Thread::wait(int32_t millisec)
|
||||||
{
|
{
|
||||||
join(millisec);
|
return join(millisec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::join(int32_t millisec)
|
rt_err_t Thread::join(int32_t millisec)
|
||||||
{
|
{
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
|
@ -107,6 +107,10 @@ void Thread::join(int32_t millisec)
|
||||||
else
|
else
|
||||||
tick = rt_tick_from_millisecond(millisec);
|
tick = rt_tick_from_millisecond(millisec);
|
||||||
|
|
||||||
rt_event_recv(&_event, 1, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, tick, RT_NULL);
|
return rt_event_recv(&_event, 1, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, tick, RT_NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -RT_ENOSYS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,16 +45,15 @@ public:
|
||||||
|
|
||||||
static void sleep(int32_t millisec);
|
static void sleep(int32_t millisec);
|
||||||
|
|
||||||
void wait(int32_t millisec);
|
rt_err_t wait(int32_t millisec);
|
||||||
void join(int32_t millisec = -1);
|
rt_err_t join(int32_t millisec = -1);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void run();
|
virtual void run(void *parameter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void func(Thread *pThis);
|
static void func(Thread *pThis);
|
||||||
|
|
||||||
private:
|
|
||||||
rt_thread_t _thread;
|
rt_thread_t _thread;
|
||||||
|
|
||||||
thread_func_t _entry;
|
thread_func_t _entry;
|
||||||
|
|
|
@ -153,7 +153,6 @@ int __low_level_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
extern int main(void);
|
|
||||||
/* Add -eentry to arm-none-eabi-gcc argument */
|
/* Add -eentry to arm-none-eabi-gcc argument */
|
||||||
int entry(void)
|
int entry(void)
|
||||||
{
|
{
|
||||||
|
@ -204,7 +203,7 @@ void rt_application_init(void)
|
||||||
result = rt_thread_init(tid, "main", main_thread_entry, RT_NULL,
|
result = rt_thread_init(tid, "main", main_thread_entry, RT_NULL,
|
||||||
main_stack, sizeof(main_stack), RT_MAIN_THREAD_PRIORITY, 20);
|
main_stack, sizeof(main_stack), RT_MAIN_THREAD_PRIORITY, 20);
|
||||||
RT_ASSERT(result == RT_EOK);
|
RT_ASSERT(result == RT_EOK);
|
||||||
|
|
||||||
/* if not define RT_USING_HEAP, using to eliminate the warning */
|
/* if not define RT_USING_HEAP, using to eliminate the warning */
|
||||||
(void)result;
|
(void)result;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue