[fpc-pascal] free vision questions

Tomas Hajny XHajT03 at mbox.vol.cz
Wed Nov 23 18:07:23 CET 2005

Tony Pelton wrote:
> hi all,
> having a great time playing with free vision right now.
> a quick question ...
> can i get a hooked into the event loop thread for doing work ?
> said a different way ...
> based on my experience with other event driven GUI paradigms ... i'm
> assuming ...
> in the background, there is a thread of execution that is polling for
> events in the ui, keyboard and mouse and dispatching those events into
> the event loop  ?
> i then trap those events in my code and "do stuff".
> standard event driven gui stuff.
> i would love to be able to "poll" some of my own code from the
> existing event thread, checking for network data, and then dispatch
> events into event queue that i can then handle inside the event loop,
> to update widgets with the data.

One possibility probably is to override the GetEvent method to add
additional events (and then you handle them in your HandleEvent method
accordingly). Everything you call in GetEvent must be non-blocking.

> bottom line, if possible, i would like to avoid spinning my own thread
> to do network polling, and once i see some data on the wire, i want to
> be able to *safely* process that data and dispatch it into widgets in
> realtime.

Well, spinning another thread which would poll the network all the time
and just issue PutEvent call afterwards might be possible in theory, but
I'm afraid that FV code has never been updated to be thread-safe (i.e.
additional effort would be required here first).


More information about the fpc-pascal mailing list