add on_idle call back function.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@829 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com
2010-08-04 23:39:01 +00:00
parent 1451735e9e
commit 898ad75a7a
4 changed files with 109 additions and 11 deletions

View File

@@ -285,6 +285,7 @@ rtgui_thread_t* rtgui_thread_register(rt_thread_t tid, rt_mq_t mq)
thread->tid = tid;
thread->mq = mq;
thread->widget = RT_NULL;
thread->on_idle = RT_NULL;
/* set user thread */
tid->user_data = (rt_uint32_t)thread;
@@ -323,6 +324,26 @@ rtgui_thread_t* rtgui_thread_self()
return thread;
}
void rtgui_thread_set_onidle(rtgui_idle_func onidle)
{
struct rtgui_thread* thread;
thread = rtgui_thread_self();
RT_ASSERT(thread != RT_NULL);
thread->on_idle = onidle;
}
rtgui_idle_func rtgui_thread_get_onidle()
{
struct rtgui_thread* thread;
thread = rtgui_thread_self();
RT_ASSERT(thread != RT_NULL);
return thread->on_idle;
}
extern rt_thread_t rt_thread_find(char* name);
rt_thread_t rtgui_thread_get_server()
{
@@ -455,6 +476,20 @@ rt_err_t rtgui_thread_recv(rtgui_event_t* event, rt_size_t event_size)
return r;
}
rt_err_t rtgui_thread_recv_nosuspend(rtgui_event_t* event, rt_size_t event_size)
{
struct rtgui_thread* thread;
rt_err_t r;
/* find rtgui_thread */
thread = (struct rtgui_thread*) (rt_thread_self()->user_data);
if (thread == RT_NULL) return -RT_ERROR;
r = rt_mq_recv(thread->mq, event, event_size, 0);
return r;
}
rt_err_t rtgui_thread_recv_filter(rt_uint32_t type, rtgui_event_t* event, rt_size_t event_size)
{
struct rtgui_thread* thread;