Initialize lock timeout on windows if timeout is infinite

Merged Ondrej Baranovič requested to merge branch/initialize_lock_timeout_on_windows into branch/default

The variable milliseconds was uninitialised if the given timeout was negative (infinite). This PR fixes the undefined behaviour, the issue I had in #2073 (comment 141518), and possibly also issue #3252 (closed).

Merge request reports