From 3d8f0353aa2e4f097ce78b82c6eb19e89ef787fa Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 11 Mar 2014 03:21:52 +0100 Subject: improve threading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- examples/threaded | 8 ++++---- 1 file 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] -- cgit v1.2.3-70-g09d2