[Python-Dev] tiny optimization in ceval mainloop

Skip Montanaro skip@pobox.com
Fri, 30 Aug 2002 08:59:04 -0500

    Skip> Any time C code would want to read or update ticker, it would have
    Skip> the GIL, right?

    Jack> Not if the idea that lead to this thread (clearing ticker if
    Jack> something is put in things_to_do) is implemented, because we may
    Jack> be in an interrupt routine at the time we fiddle things_to_do.

    Jack> And I don't think we can be sure that even clearing is guaranteed
    Jack> to work (if another thread is halfway a load-decrement-store
    Jack> sequence the clear could be lost).

Hmm...  I guess you lost me.  The code that fiddles the ticker in ceval.c
clearly operates while the GIL is held.  I think the code in sysmodule.c
that updates the checkinterval works under that assumption as well.  The
other ticker in longobject.c I'm not so sure about.

The patch I submitted doesn't implement the ticker clear that Jeremy
originally suggested.  It just pulls the ticker and the checkinterval out of
the thread state and makes them two globals.  They are both manipulated in
otherwise the same way.