On 2/27/07, Travis E. Oliphant <[EMAIL PROTECTED]> wrote:
> My understanding of this locking mechanism would require objects that
> wish to use it to keep track of how many views they have "exported" and
> refuse to re-allocate memory until the views have all been released.

Right.

> In my understanding this would require the addition of at least one
> integer to the object structure.

Right.

> So, for example, the bytesobject would need to at least add
>
> int ob_views
>
> to its C-structure:
>
> /* Object layout */
> typedef struct {
>      PyObject_VAR_HEAD
>      Py_ssize_t ob_alloc; /* How many bytes allocated */
>      int ob_views; /* Number of views to these bytes */
>      char *ob_bytes;
> } PyBytesObject;
>
> On creation, ob_views would be initialized to 0 and whenever getbuffer
> was called it would increase this number and whenever releasebuffer was
> called it would decrease this number.
>
> Am I missing something here?

I don't think so -- this is exactly what I was thinking of.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to