[Python-checkins] r75631 - in sandbox/trunk/newgil: Include/ceval.h Makefile.pre.in Modules/_io/fileio.c Modules/_multiprocessing/connection.hModules/_multiprocessing/pipe_connection.c Modules/_multiprocessing/socket_connection.cModules/_ssl.c Modules/bz2module.cModules/posixmodule.c Modules/selectmodule.cModules/socketmodule.c Objects/longobject.c Python/ceval.c Python/ceval_pthread.h Python/pystate.c

Antoine Pitrou solipsis at pitrou.net
Fri Oct 23 20:42:57 CEST 2009


M.-A. Lemburg <mal <at> egenix.com> writes:
> 
> >  /* this used to be handled on a per-thread basis - now just two globals */
> > -PyAPI_DATA(volatile int) _Py_Ticker;
> > +// PyAPI_DATA(volatile int) _Py_Ticker;
> 
> It's better not to let C++ comment sneak into the code 

This is dead code anyway, it has been removed in a subsequent commit.
I may have a couple of C++-style comments remaining, I will fix them.

> > +#define ADD_MILLISECONDS(tv, interval) \
> > +do { \
> > +    tv.tv_usec += interval * 1000; \
> > +    tv.tv_sec += tv.tv_usec / 1000000; \
> > +    tv.tv_usec %= 1000000; \
> > +} while (0)
> > +
> > +/* milliseconds */
> > +#define INTERVAL 5
> 
> If you want to use a more accurate timer, you should have a look
> at clock_gettime() which is available on more recent POSIX compatible
> systems.

Microseconds are enough for this chunk of code :)

Besides, while clock_gettime() provides a theoretically higher precision
(nanoseconds instead of microseconds), the actual precision doesn't seem to be
higher under Linux. And it would probably need a detection check, and a fallback
to gettimeofday()...

Regards

Antoine.




More information about the Python-checkins mailing list