diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-03-11 03:21:52 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-03-11 03:21:52 +0100 |
commit | 3d8f0353aa2e4f097ce78b82c6eb19e89ef787fa (patch) | |
tree | aac45291164bb192b3fc366c509d912916388797 | |
parent | add threaded example (diff) | |
download | blueshift-3d8f0353aa2e4f097ce78b82c6eb19e89ef787fa.tar.gz blueshift-3d8f0353aa2e4f097ce78b82c6eb19e89ef787fa.tar.bz2 blueshift-3d8f0353aa2e4f097ce78b82c6eb19e89ef787fa.tar.xz |
improve threading
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | examples/threaded | 8 |
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] |