Skip Menu |

This queue is for tickets about the Win32-MMF CPAN distribution.

Report information
The Basics
Id: 47048
Status: new
Priority: 0/
Queue: Win32-MMF

People
Owner: Nobody in particular
Requestors: roger [...] hiddenengine.co.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.09e
Fixed in: (no value)



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" (http://msdn.microsoft.com/en-us/library/ms687032.aspx) 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.