[tekui-devel] tekUI and I/O

Timm S. Mueller tmueller at schulze-mueller.de
Tue May 14 19:42:43 CEST 2013

On Tue, 14 May 2013 18:48:27 +0200
Stefan Reich <stefan.reich.maker.of.eye at googlemail.com> wrote:

> I want to do I/O (LuaSocket) in a tekUI app. I saw that I can just call
> app:addCoroutine to have stuff done in the background. That's a nice start.
> But what I'm still missing is a way to socket-select for new data and then
> resume the appropriate coroutines... in parallel to tekUI doing its stuff.
> Any quick hint on how to do this?

In your coroutine, call app:suspend() to cooperate with the GUI.
app:suspend(), if called without an argument, returns to you as quickly
as possible. So you can use a timeout on select, and service the GUI
regardless of whether something appeared on a socket or not. This call
isn't very expensive if nothing happened in the GUI. See tsp.lua as an

> Cheers,
> Stefan

- Timm

Timm S. Mueller <tmueller at schulze-mueller.de>
Schulze & Mueller GbR, Jungstr. 2, 10247 Berlin,
Gesellschafter: Franciska Schulze, Timm S. Mueller,
Tel. +49 30 85610000, http://www.schulze-mueller.de/

More information about the tekui-devel mailing list