I have been develop a blocking socket application with threading. The
main thread handles connections and inserts them into python's
protected queue as jobs for the thread pool to handle.
There is not much information on threading.local except that it states
that in maintains variable uniqueness among multiple instances of the
same thread. I am assuming that it implements some sort of locking
functionality under the covers? Is it possible to run into a race
condition using threading.local?
In a non-blocking threaded socket receive handler is it better to use a
threading.local variable for writes or protect the write with a
I know the size of the incoming request so the receive handler finishes
when the max size is reached. However in case of network problems I
also have timeout functionality. Both of these behaviors require
writing to variables in a possible critical section.
What is the best way to handle writes in a multi-threaded non-blocking