summaryrefslogtreecommitdiff
path: root/components/rtgui/common/rtgui_system.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2010-08-04 23:39:01 +0000
committer[email protected] <[email protected]>2010-08-04 23:39:01 +0000
commit898ad75a7afec41a8d91c9dbe7f6ff5c9a47a572 (patch)
treeb9ce66c28cba9dbd4ef87099a83e0f06bd139c0e /components/rtgui/common/rtgui_system.c
parent1451735e9edecb2d11576920af36b55e8a539a0d (diff)
add on_idle call back function.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@829 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/common/rtgui_system.c')
-rw-r--r--components/rtgui/common/rtgui_system.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/components/rtgui/common/rtgui_system.c b/components/rtgui/common/rtgui_system.c
index df438ab5ee..cb04189266 100644
--- a/components/rtgui/common/rtgui_system.c
+++ b/components/rtgui/common/rtgui_system.c
@@ -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;