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

M.-A. Lemburg mal at egenix.com
Fri Oct 23 20:07:23 CEST 2009


antoine.pitrou wrote:
> Author: antoine.pitrou
> Date: Fri Oct 23 19:38:14 2009
> New Revision: 75631
> 
> Log:
> Commit initial patch (from personal hg repo).
> 
> Only POSIX-compatible for now. I plan to try and make it working on Windows.

...

>  /* 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 :-)

> Added: sandbox/trunk/newgil/Python/ceval_pthread.h
> ==============================================================================
> --- (empty file)
> +++ sandbox/trunk/newgil/Python/ceval_pthread.h	Fri Oct 23 19:38:14 2009
> @@ -0,0 +1,258 @@
> +/*
> + * Implementation of the Global Interpreter Lock (GIL) for POSIX pthreads.
> + */
> +
> +#include <stdlib.h>
> +#include <errno.h>
> +#include <pthread.h>
> +
> +/* We assume all modern POSIX systems have gettimeofday() */
> +#ifdef GETTIMEOFDAY_NO_TZ
> +#define GETTIMEOFDAY(ptv) gettimeofday(ptv)
> +#else
> +#define GETTIMEOFDAY(ptv) gettimeofday(ptv, (struct timezone *)NULL)
> +#endif
> +
> +#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.

The API provides access to several high precision timers.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Oct 23 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the Python-checkins mailing list