[Python-Dev] PyWeakref_GetObject() borrows its reference from... whom? (original) (raw)
Random832 random832 at fastmail.com
Mon Oct 10 14:24:20 EDT 2016
- Previous message (by thread): [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?
- Next message (by thread): [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Oct 10, 2016, at 14:04, MRAB wrote:
Instead of locking the object, could we keep the GIL, but have it normally released?
A thread could then still call a function such as PyWeakrefGetObject() that returns a borrowed reference, but only if it's holding the GIL. It would be able to INCREF the reference before releasing the GIL again.
So, what stops the other thread which never asks for the GIL from blowing away the reference? Or is this a special kind of lock that you can "assert isn't locked" without locking it for yourself, and INCREF/DECREF does so?
- Previous message (by thread): [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?
- Next message (by thread): [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]