[fpc-devel] Inconsistent use of Timeout in SimpleIPC
Denis Kozlov
dezlov at gmail.com
Wed Dec 2 17:16:56 CET 2015
Hello,
Current use of Timeout parameter in TSimpleIPCServer.PeekMessage:
* >0 -- number of milliseconds to wait.
* 0 -- not documented and inconsistent!
* Windows -- wait infinitely (forced via MsgWaitForMultipleObjects)
* Unix -- return immediately (implicit via fpSelect)
* OS/2 -- return immediately (implicit via DosWaitEventSem)
* Amiga -- wait 25 ms (forced via Sleep)
* -1 -- not documented, but consistent!
* Windows -- wait infinitely (implicit via MsgWaitForMultipleObjects)
* Unix -- wait infinitely (implicit via fpSelect)
* OS/2 -- wait infinitely (implicit via DosWaitEventSem)
* Amiga -- wait for MaxInt ms (implicit via Sleep)
* <-1 -- not documented and inconsistent!
The biggest problem is that it is impossible to get PeekMessage to return
immediately in Windows, making SimpleIPC unusable in GUI thread (or other
high performance threads).
I propose the following consistent use of Timeout parameter:
* >0 -- number of milliseconds to wait.
* 0 -- return immediately.
* -1 -- wait infinitely.
* <-1 -- wait infinitely (force to -1).
I can produce a patch and a test project, if there are no objections.
Regards,
Denis Kozlov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20151202/08ef6999/attachment.html>
More information about the fpc-devel
mailing list