|Subject:||-timeout pameter description is wrong|
The documentation describes -timeout as being in seconds and the value of 0 indicating an indefinite delay until the semaphore is obtained. The underlying Windows call "WaitForSingleObject" (defines the timeout value as being in milliseconds with 0 being an immediate return and "INFINITE" (-1) requesing an indefinite delay. The XS code (MMF.xs lines 691-694) sets timeout to 0 if negative and does not perform the scaling from seconds to milliseconds before calling the WaitForSingleObject function. The documentation therefore describes very different behaviour to that which is implemented. By default, for example, the semaphore acquisition time is just 10 msec and not 10 sec as described and it is impossible to request an indefinite delay. I would suggest changing line 691 in MMF.xs from "if (timeout < 0) timeout = 0;" to "if (timeout < -1) timeout = -1;", changing line 101 in MMF.pm from "_timeout => 10," to "_timeout => 10_000," and updating the description to indicate that the timeout resolution is in msecs and that -1 requests an indefinite delay. This should not break any code that currently works unless they are setting timeout to a negative value by accident.