Accessing a lock object in a C module

David Fisher python at rose164.wuh.wustl.edu
Wed Feb 2 11:27:56 EST 2000


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 2/1/00, 8:54:54 AM, Konrad Hinsen <hinsen at cnrs-orleans.fr> wrote 
regarding Accessing a lock object in a C module:


> For a threaded application, I need to access a lock both from Python
> code and from a C extension module, but I haven't yet found a way to
> do that.

> If I create a lock object in Python via the thread module, I can't
> access its lock_lock member; the structure definition is not in a
> header file, and there is no C-level access routine either. Inversely,
> if I create a lock in a C module, I can't create a corresponding lock
> object accessible from Python.

The struct is at the top of threadmodule.c:
/* Lock objects */

typedef struct {
	PyObject_HEAD
	PyThread_type_lock lock_lock;
} lockobject;

hope this helps,
David Fisher







More information about the Python-list mailing list