lua-users home
lua-l archive

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

Ah, yeah.

Your flag thing is a "one entry queue" but I was expecting Bert not to want to lose a single interrupt (and them to be different, like having some data values attached, that Lua would care about).

Anyways, already this is getting speculative, since we don't know what Bert does. Bert: if you want an event dispatch queue, I can send code I've used in LuaX/SDL_mixer, to catch played music samples at real time (and show the graphs by Lua). Don't remember about memory allocation, but yes, most likely one alloc per interrupt is needed there.


David Given kirjoitti 15.5.2006 kello 20.00:

Hash: SHA1

Asko Kauppi wrote:
I would consider doing an "event dispatch" interrupt handler (in C) that would sit in the other end of a FIFO queue, the other end being polled
by Lua (can you run one instance, as the main loop?) to take in

A common technique is to have the interrupt handler set a bit to say
'this interrupt has happened'. Your userspace code then polls all the
various bits, does its work, and then clears them again. Getting the
logic right to ensure that all interrupts are properly serviced is a bit
challenging, and of course you lose any kind of real-time-ness, but it
does allow you to avoid having to allocate memory during your interrupt

- --
+- David Given --McQ-+ "Preacher, don't the Bible have some pretty
|    | specific things to say about killing?" "Quite
| ( | specific. It is, however, somewhat fuzzier on the +- --+ subject of kneecaps." --- Firefly, _War Stories_
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla -