[fpc-pascal] Best way to check SimpleIPC for messages
Michael Van Canneyt
michael at freepascal.org
Fri May 12 16:37:18 CEST 2017
On Fri, 12 May 2017, noreply at z505.com wrote:
> Is the best general way to check IPC messages in SimpleIPC to spawn a
> thread? and check
>
> I noticed in fpgui sample apps that use simpleipc, graemeg checks the
> messages in the fpgui OnIdle event, AFAICT, not a separate thread. But
> what if you are running a console mode program that has no onidle event?
>
> Obviously "avoid threads where possible" but only if there is a simpler
> mechanism not reinventing a thread. So it seems to me onidle in fpgui is
> a simpler way than creating a new separate thread yourself, but how to
> do it in a program that has no fpgui onidle?
Check manually. What else is left ?
There is no message queue, so no loop in which to check at regular basis.
> On that note what would a lazarus app generally do to check for
> messages, without locking the app up? A similar OnIdle solution?
Yes. The sample programs check in Application.OnIdle.
Michael.
More information about the fpc-pascal
mailing list