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
lock.acquire/lock.release ?

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
receive handler?

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
postedMay 1, '06 at 8:56p
activeMay 1, '06 at 8:56p

1 user in discussion

Juxstapose: 1 post



site design / logo © 2022 Grokbase