[Python-Dev] Variant of removing GIL.
falcon at intercable.ru
Thu Sep 15 09:47:38 CEST 2005
Now, every thread keeps one n queue of objects to incref and second
queue to decref.
Both can be implemented as array, cause they will be freed at once.
Initially, every thread acquires GIL for "read".
Py_INCREF places a ref into a incref queue of a thread,
Py_DECREF places a ref into a decref queue of a thread.
When queue has became full or "100" instruction left ( :-) , it usefull),
thread releases GIL for "read" and acquires for "write",
when first process acquire it he:
walk throw all incref queues in all threads, incref all thouse
refs, and clear queues.
then walk throw all decref queues in all threads, decref all
thouse refs, and clear queues
After all he acquires GIL for "read". Other processes could stupidly
repeat it founding clear queues.
Since there only one thread works as a "garbage collector", we will not
loose any incref and decref.
More information about the Python-Dev