[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: coroutines ??avoid the busy wait
- From: gary ng <garyng2000@...>
- Date: Mon, 24 Dec 2007 16:57:45 -0800 (PST)
If you are running linux, it is quite possible to
'stuff' the IR file handle into lua socket and have it
listened by COPAS(a coroutine based scheduler).
--- Mildred <firstname.lastname@example.org> wrote:
> I'm creating a program to handle infrared events
> from my remote control
> and perform several different actions. Basically, I
> just wait in a loop
> for IR events, and perform the actions I want. But
> now, sometimes I
> want to draw a menu on the screen. So I set up an
> X11 window and draw
> text on it. The problem is that it is never
> refreshed. So if another
> window goes in front of it, the drawing is lost.
> So I thought about using coroutines and the problem
> is that nothing may
> happen for a long time. So my scheduler would just
> go from a thread to
> another just to check there is nothing to do ... a
> busy wait.
> I don't know how I could solve that. I can't use the
> method described
> in the PiL (that calling a function that will sleep
> until a socket
> receive data) since the threads are triggered by
> different kind of
> Also, i don't like to add a sleep in the scheduler
> because it would
> force my CPU to resume (and so, consume power) even
> if it has nothing
> to do.
> Can you help me ?
> Mildred Ki'lya
> E-Mail: mildred593(at)online.fr
> Site: <http://mildred632.free.fr/>
> XMPP: <email@example.com> (GoogleTalk, Jabber)
> GPG: 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping