summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-11 03:21:52 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-11 03:21:52 +0100
commit3d8f0353aa2e4f097ce78b82c6eb19e89ef787fa (patch)
treeaac45291164bb192b3fc366c509d912916388797 /examples
parentadd threaded example (diff)
downloadblueshift-3d8f0353aa2e4f097ce78b82c6eb19e89ef787fa.tar.gz
blueshift-3d8f0353aa2e4f097ce78b82c6eb19e89ef787fa.tar.bz2
blueshift-3d8f0353aa2e4f097ce78b82c6eb19e89ef787fa.tar.xz
improve threading
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/threaded8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/threaded b/examples/threaded
index 962563a..7b37cce 100644
--- a/examples/threaded
+++ b/examples/threaded
@@ -29,25 +29,25 @@ class threadlocal:
self.tmap = {}
def __getitem__(self, i):
- t = threading.current_thread()
+ t = threading.get_ident()
if t not in self.tmap:
self.tmap[t] = self.default[:]
return self.tmap[t][i]
def __len__(self):
- t = threading.current_thread()
+ t = threading.get_ident()
if t not in self.tmap:
self.tmap[t] = self.default[:]
return len(self.tmap[t])
def __setitem__(self, i, x):
- t = threading.current_thread()
+ t = threading.get_ident()
if t not in self.tmap:
self.tmap[t] = self.default[:]
self.tmap[t][i] = x
def __delitem__(self, i):
- t = threading.current_thread()
+ t = threading.get_ident()
if t not in self.tmap:
self.tmap[t] = self.default[:]
del self.tmap[t][x]