10 Oct
2016
10 Oct
'16
6:24 p.m.
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 PyWeakref_GetObject() 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?