Guido van Rossum wrote:
> On 2/26/07, Travis Oliphant <[EMAIL PROTECTED]> wrote:
>> Guido van Rossum wrote:
>> Great. I have no problem with this. Is your idea of locking the same
>> as mine (i.e. a function in the API for release?)
>
> Right.
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.
In my understanding this would require the addition of at least one
integer to the object structure.
So, for example, the bytesobject would need to at least add
int ob_views
to it's 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?
-Travis
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com