Using clock() in threading on Windows

"Martin v. Löwis" martin at v.loewis.de
Sat Feb 21 04:15:39 EST 2009


> Would it not be better to use time.clock() instead? 

If you really want to reconsider this implementation, I think it
would be best to use relative timeouts all the way down to the
system. In the specific case of Windows, WaitForSingleObject
expects a relative number of milliseconds (i.e. a wait duration).
As this is also what the Python script passes (in seconds),
it is best to leave issues of timer resolution to the operating
system (which we have to trust anyway).

As a consequence, the half-busy loops could go away, at least
on systems where lock timeouts can be given to the system.

Regards,
Martin



More information about the Python-list mailing list