diff options
Diffstat (limited to 'gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py')
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py b/gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py index dee8034c1c..ff33224d58 100644 --- a/gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py +++ b/gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py @@ -4,15 +4,18 @@ # It's been patched to fix a problem with join, where a KeyboardInterrupt # caused a lock to be left in the acquired state. +from __future__ import print_function +from __future__ import unicode_literals + import sys as _sys try: - import thread + import _thread except ImportError: del _sys.modules[__name__] raise -from StringIO import StringIO as _StringIO +from io import StringIO as _StringIO from time import time as _time, sleep as _sleep from traceback import print_exc as _print_exc @@ -21,11 +24,11 @@ __all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Timer', 'setprofile', 'settrace'] -_start_new_thread = thread.start_new_thread -_allocate_lock = thread.allocate_lock -_get_ident = thread.get_ident -ThreadError = thread.error -del thread +_start_new_thread = _thread.start_new_thread +_allocate_lock = _thread.allocate_lock +_get_ident = _thread.get_ident +ThreadError = _thread.error +del _thread # Debug support (adapted from ihooks.py). @@ -127,8 +130,9 @@ class _RLock(_Verbose): # Internal methods used by condition variables - def _acquire_restore(self, (count, owner)): + def _acquire_restore(self, lock): self.__block.acquire() + count, owner = lock self.__count = count self.__owner = owner if __debug__: @@ -313,7 +317,7 @@ class _BoundedSemaphore(_Semaphore): def release(self): if self._Semaphore__value >= self._initial_value: - raise ValueError, "Semaphore released too many times" + raise ValueError("Semaphore released too many times") return _Semaphore.release(self) @@ -627,7 +631,7 @@ def activeCount(): def enumerate(): _active_limbo_lock.acquire() - active = _active.values() + _limbo.values() + active = list(_active.values()) + list(_limbo.values()) _active_limbo_lock.release() return active @@ -698,7 +702,7 @@ def _test(): def run(self): while self.count > 0: item = self.queue.get() - print item + print(item) self.count = self.count - 1 NP = 3 |