Extension modules, Threading, and the GIL

Skip Montanaro skip at pobox.com
Thu Jan 2 22:50:36 CET 2003

    >> Looking over the thread-sig archives, Greg Stein suggested that TLS
    >> could be emulated on platforms which don't offer it natively using a
    >> Python dict and a lock (at any rate, it should be possible with some
    >> sort of synchronized data structure).

    Martin> This points to another sore spot: that would require reliable
    Martin> thread identification. Currently, thread identification is
    Martin> broken, as Python assumes that an int is sufficient to
    Martin> encapsulate a thread id. There are platforms where this
    Martin> assumption is invalid.

Perhaps a ThreadIdentifier class should be developed as an abstraction of
the thread id.  Instances of that class would then encapsulate the actual
identifier returned by the specific thread package being used.  Make
ThreadIdentifier immutable so you can use it in the aforementioned fake TLS.


More information about the Python-list mailing list