threads / dictionaries

.d.hos dhostetler at sopris.net
Wed Jan 15 15:21:05 EST 2003


Hello everybody,
I have a mutlithreading script in which I would like to create a
unique dictionary for each thread.

Currently, If thread 1 is writing to a dictionary, and thread 2
returns in the middle of that process, thread 1's dictionary is
overwritten with thread 2's entries. If I Space out the threads with
the sleep() function long enough, each dictionary returns a unique
dictionary - but that kinda kills the purpose of multithreading...?

can i dynamically name each dictionary for each thread? I've tried
using the thread id as the dictionary name - but to no avail...(could
be my coding)

I'm struggling with this and any help, or ideas (if this is the wrong
approach) would be great - If you can't tell, python is a new venture
for me.

thanks in advance,
.d.hos




More information about the Python-list mailing list