[fpc-devel] Inconsistent use of Timeout in SimpleIPC

Michael Van Canneyt michael at freepascal.org
Thu Dec 3 10:06:16 CET 2015



On Wed, 2 Dec 2015, Denis Kozlov wrote:

> 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.

There are no objections.

Michael.



More information about the fpc-devel mailing list