Example #1
0
class TracingFunctionHolder:
    '''This class exists just to keep some variables (so that we don't keep them in the global namespace). 
    '''
    _original_tracing = None
    _warn = True
    _lock = _pydev_thread.allocate_lock()
    _traceback_limit = 1
    _warnings_shown = {}
def CustomFramesContainerInit(): #Note: no staticmethod on jython 2.1 (so, use free-function)
    
    CustomFramesContainer.custom_frames_lock = _pydev_thread.allocate_lock()
    
    # custom_frames can only be accessed if properly locked with custom_frames_lock! 
    # Key is a string identifying the frame (as well as the thread it belongs to). 
    # Value is a CustomFrame.
    #
    CustomFramesContainer.custom_frames = {}
    
    # Only to be used in this module
    CustomFramesContainer._next_frame_id = 0
    
    # This is the event we must set to release an internal process events. It's later set by the actual debugger
    # when we do create the debugger.
    CustomFramesContainer._py_db_command_thread_event = Null()
def CustomFramesContainerInit(
):  #Note: no staticmethod on jython 2.1 (so, use free-function)

    CustomFramesContainer.custom_frames_lock = _pydev_thread.allocate_lock()

    # custom_frames can only be accessed if properly locked with custom_frames_lock!
    # Key is a string identifying the frame (as well as the thread it belongs to).
    # Value is a CustomFrame.
    #
    CustomFramesContainer.custom_frames = {}

    # Only to be used in this module
    CustomFramesContainer._next_frame_id = 0

    # This is the event we must set to release an internal process events. It's later set by the actual debugger
    # when we do create the debugger.
    CustomFramesContainer._py_db_command_thread_event = Null()
Example #4
0
 def __init__(self, maxsize=0):
     self.maxsize = maxsize
     self._init(maxsize)
     # mutex must be held whenever the queue is mutating.  All methods
     # that acquire mutex must release it before returning.  mutex
     # is shared between the three conditions, so acquiring and
     # releasing the conditions also acquires and releases mutex.
     self.mutex = _pydev_thread.allocate_lock()
     # Notify not_empty whenever an item is added to the queue; a
     # thread waiting to get is notified then.
     self.not_empty = _threading.Condition(self.mutex)
     # Notify not_full whenever an item is removed from the queue;
     # a thread waiting to put is notified then.
     self.not_full = _threading.Condition(self.mutex)
     # Notify all_tasks_done whenever the number of unfinished tasks
     # drops to zero; thread waiting to join() is notified to resume
     self.all_tasks_done = _threading.Condition(self.mutex)
     self.unfinished_tasks = 0
Example #5
0
 def __init__(self, maxsize=0):
     self.maxsize = maxsize
     self._init(maxsize)
     # mutex must be held whenever the queue is mutating.  All methods
     # that acquire mutex must release it before returning.  mutex
     # is shared between the three conditions, so acquiring and
     # releasing the conditions also acquires and releases mutex.
     self.mutex = _pydev_thread.allocate_lock()
     # Notify not_empty whenever an item is added to the queue; a
     # thread waiting to get is notified then.
     self.not_empty = _threading.Condition(self.mutex)  # @UndefinedVariable
     # Notify not_full whenever an item is removed from the queue;
     # a thread waiting to put is notified then.
     self.not_full = _threading.Condition(self.mutex)  # @UndefinedVariable
     # Notify all_tasks_done whenever the number of unfinished tasks
     # drops to zero; thread waiting to join() is notified to resume
     self.all_tasks_done = _threading.Condition(self.mutex)  # @UndefinedVariable
     self.unfinished_tasks = 0
    def __init__(self):
        AbstractPyDBAdditionalThreadInfo.__init__(self)
        #That's where the last frame entered is kept. That's needed so that we're able to
        #trace contexts that were previously untraced and are currently active. So, the bad thing
        #is that the frame may be kept alive longer than it would if we go up on the frame stack,
        #and is only disposed when some other frame is removed.
        #A better way would be if we could get the topmost frame for each thread, but that's
        #not possible (until python 2.5 -- which is the PyDBAdditionalThreadInfoWithCurrentFramesSupport version)
        #Or if the user compiled threadframe (from http://www.majid.info/mylos/stories/2004/06/10/threadframe.html)

        #NOT RLock!! (could deadlock if it was)
        self.lock = _pydev_thread.allocate_lock()
        self._acquire_lock = self.lock.acquire
        self._release_lock = self.lock.release

        #collection with the refs
        d = {}
        self.pydev_existing_frames = d
        try:
            self._iter_frames = d.iterkeys
        except AttributeError:
            self._iter_frames = d.keys
    def __init__(self):
        AbstractPyDBAdditionalThreadInfo.__init__(self)
        #That's where the last frame entered is kept. That's needed so that we're able to
        #trace contexts that were previously untraced and are currently active. So, the bad thing
        #is that the frame may be kept alive longer than it would if we go up on the frame stack,
        #and is only disposed when some other frame is removed.
        #A better way would be if we could get the topmost frame for each thread, but that's
        #not possible (until python 2.5 -- which is the PyDBAdditionalThreadInfoWithCurrentFramesSupport version)
        #Or if the user compiled threadframe (from http://www.majid.info/mylos/stories/2004/06/10/threadframe.html)

        #NOT RLock!! (could deadlock if it was)
        self.lock = _pydev_thread.allocate_lock()
        self._acquire_lock = self.lock.acquire
        self._release_lock = self.lock.release

        #collection with the refs
        d = {}
        self.pydev_existing_frames = d
        try:
            self._iter_frames = d.iterkeys
        except AttributeError:
            self._iter_frames = d.keys
Example #8
0
try:
    IS_64_BITS = sys.maxsize > 2 ** 32
except AttributeError:
    try:
        import struct
        IS_64_BITS = struct.calcsize("P") * 8 > 32
    except:
        IS_64_BITS = False

SUPPORT_GEVENT = os.getenv('GEVENT_SUPPORT', 'False') == 'True'

USE_LIB_COPY = SUPPORT_GEVENT and not IS_PY3K and sys.version_info[1] >= 6
import _pydev_threading as threading

from _pydev_imps import _pydev_thread
_nextThreadIdLock = _pydev_thread.allocate_lock()

#=======================================================================================================================
# Jython?
#=======================================================================================================================
try:
    DictContains = dict.has_key
except:
    try:
        #Py3k does not have has_key anymore, and older versions don't have __contains__
        DictContains = dict.__contains__
    except:
        try:
            DictContains = dict.has_key
        except NameError:
            def DictContains(d, key):
Example #9
0
try:
    IS_64_BITS = sys.maxsize > 2 ** 32
except AttributeError:
    try:
        import struct
        IS_64_BITS = struct.calcsize("P") * 8 > 32
    except:
        IS_64_BITS = False

SUPPORT_GEVENT = os.getenv('GEVENT_SUPPORT', 'False') == 'True'

USE_LIB_COPY = SUPPORT_GEVENT and not IS_PY3K and sys.version_info[1] >= 6
import _pydev_threading as threading

from _pydev_imps import _pydev_thread
_nextThreadIdLock = _pydev_thread.allocate_lock()

#=======================================================================================================================
# Jython?
#=======================================================================================================================
try:
    DictContains = dict.has_key
except:
    try:
        #Py3k does not have has_key anymore, and older versions don't have __contains__
        DictContains = dict.__contains__
    except:
        try:
            DictContains = dict.has_key
        except NameError:
            def DictContains(d, key):
Example #10
0
class AdditionalFramesContainer:
    lock = _pydev_thread.allocate_lock()
    additional_frames = {}  #dict of dicts