[Lazarus] Shell notifications
henry.vermaak at gmail.com
Wed Aug 21 15:07:19 CEST 2013
On Wed, Aug 21, 2013 at 12:36:56PM +0000, Mark Morgan Lloyd wrote:
> Michael Schnell wrote:
> >On 08/20/2013 02:56 PM, Henry Vermaak wrote:
> >>... together with select()..
> >In Object Pascal I think this should be encapsulated in a thread
> >and same fires a main Thread event (via TThread.Queue,
> >TThread.Synchronize, or Application.QueueAsyncCall) to notify the
> >user (aka Main Thread).
> 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.
Well, the thread exists only because of the blocking nature of the
wait/select function. If that's the only task of the application the
thread isn't needed, of course.
It's more portable and self contained than the alternatives I can think
of. The most efficient way to do this would probably be to plumb it
straight into the event loop that is in use (if there is one). E.g. you
can add file descriptors to the glib event loop. I don't know how that
can be done with the Windows message loop, mind you. This approach
isn't easy to abstract, though.
More information about the Lazarus