DebugClients/Python3/DebugClientThreads.py

changeset 2987
c99695c0f13a
parent 2302
f29e9405c851
child 3160
209a07d7e401
equal deleted inserted replaced
2986:cd4e2cab7eb2 2987:c99695c0f13a
33 @param args arguments to pass to target 33 @param args arguments to pass to target
34 @param kwargs keyword arguments to pass to target 34 @param kwargs keyword arguments to pass to target
35 @return The identifier of the created thread 35 @return The identifier of the created thread
36 """ 36 """
37 if DebugClientBase.DebugClientInstance is not None: 37 if DebugClientBase.DebugClientInstance is not None:
38 return DebugClientBase.DebugClientInstance.attachThread(target, args, kwargs) 38 return DebugClientBase.DebugClientInstance.attachThread(
39 target, args, kwargs)
39 else: 40 else:
40 return _original_start_thread(target, args, kwargs) 41 return _original_start_thread(target, args, kwargs)
41 42
42 # make _thread hooks available to system 43 # make _thread hooks available to system
43 _original_start_thread = _thread.start_new_thread 44 _original_start_thread = _thread.start_new_thread
64 DebugClientBase.DebugClientBase.__init__(self) 65 DebugClientBase.DebugClientBase.__init__(self)
65 66
66 # protection lock for synchronization 67 # protection lock for synchronization
67 self.clientLock = RLock() 68 self.clientLock = RLock()
68 69
69 # the "current" thread, basically the thread we are at a breakpoint for. 70 # the "current" thread, basically the thread we are at a breakpoint
71 # for.
70 self.currentThread = None 72 self.currentThread = None
71 73
72 # special objects representing the main scripts thread and frame 74 # special objects representing the main scripts thread and frame
73 self.mainThread = None 75 self.mainThread = None
74 self.mainFrame = None 76 self.mainFrame = None
75 77
76 self.variant = 'Threaded' 78 self.variant = 'Threaded'
77 79
78 def attachThread(self, target=None, args=None, kwargs=None, mainThread=False): 80 def attachThread(self, target=None, args=None, kwargs=None,
81 mainThread=False):
79 """ 82 """
80 Public method to setup a thread for DebugClient to debug. 83 Public method to setup a thread for DebugClient to debug.
81 84
82 If mainThread is non-zero, then we are attaching to the already 85 If mainThread is non-zero, then we are attaching to the already
83 started mainthread of the app and the rest of the args are ignored. 86 started mainthread of the app and the rest of the args are ignored.
84 87
85 @param target the start function of the target thread (i.e. the user code) 88 @param target the start function of the target thread (i.e. the
89 user code)
86 @param args arguments to pass to target 90 @param args arguments to pass to target
87 @param kwargs keyword arguments to pass to target 91 @param kwargs keyword arguments to pass to target
88 @param mainThread True, if we are attaching to the already 92 @param mainThread True, if we are attaching to the already
89 started mainthread of the app 93 started mainthread of the app
90 @return identifier of the created thread 94 @return identifier of the created thread

eric ide

mercurial