lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

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 <> wrote:

> Hi,
> 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
> events.
> 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 ?
> Thanks.
> Mildred
> -- 
> Mildred Ki'lya
> E-Mail:	mildred593(at)
> Site:	<>
> XMPP:	<> (GoogleTalk, Jabber)
> GPG:	197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D
> 2E2B]

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.