[pypy-commit] pypy stacklet: Add a __del__ method. Hard to test.
arigo
noreply at buildbot.pypy.org
Sat Aug 6 12:31:21 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: stacklet
Changeset: r46315:b609083d748a
Date: 2011-08-06 11:48 +0200
http://bitbucket.org/pypy/pypy/changeset/b609083d748a/
Log: Add a __del__ method. Hard to test.
diff --git a/pypy/module/_stacklet/interp_stacklet.py b/pypy/module/_stacklet/interp_stacklet.py
--- a/pypy/module/_stacklet/interp_stacklet.py
+++ b/pypy/module/_stacklet/interp_stacklet.py
@@ -25,6 +25,8 @@
def __del__(self):
thrd = self.thrd
if thrd:
+ if self.main_stacklet is not None:
+ self.main_stacklet.__del__()
self.thrd = lltype.nullptr(rstacklet.thread_handle.TO)
rstacklet.deletethread(thrd)
@@ -56,6 +58,12 @@
self.sthread = sthread
self.h = h
+ def __del__(self):
+ h = self.h
+ if h:
+ self.h = NULLHANDLE
+ rstacklet.destroy(self.sthread.thrd, h)
+
def consume_handle(self):
h = self.h
if h:
More information about the pypy-commit
mailing list