Michael Schnell wrote:
On 08/21/2013 02:36 PM, Mark Morgan Lloyd wrote:
I know it's the obvious way, but surely there is something more elegant than having a thread which exists solely to transfer the result of a select() to the main part of the app, and then repeats

I suppose a thread is the only way to do this in a portable way.

The cost of a thread is close to zero. It just blocks in the requests and does a single turn for any change.

[Noting also Henry's comment] I suppose that, at least for unix platforms, you could have a single app-wide thread which selects on designated handles and syncs a magic number to the foreground. The tricky bit, which would merit attention from somebody who really knows the native APIs, would be adding and removing handles on the fly.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to