1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.DebugClients.Python.DebugClientThreads</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.DebugClients.Python.DebugClientThreads</h1> |
|
23 <p> |
|
24 Module implementing the multithreaded version of the debug client. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>_original_start_thread</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#DebugClientThreads">DebugClientThreads</a></td> |
|
34 <td>Class implementing the client side of the debugger.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <h3>Functions</h3> |
|
38 <table> |
|
39 <tr> |
|
40 <td><a href="#_debugclient_start_new_thread">_debugclient_start_new_thread</a></td> |
|
41 <td>Module function used to allow for debugging of multiple threads.</td> |
|
42 </tr> |
|
43 </table> |
|
44 <hr /><hr /> |
|
45 <a NAME="DebugClientThreads" ID="DebugClientThreads"></a> |
|
46 <h2>DebugClientThreads</h2> |
|
47 <p> |
|
48 Class implementing the client side of the debugger. |
|
49 </p><p> |
|
50 This variant of the debugger implements a threaded debugger client |
|
51 by subclassing all relevant base classes. |
|
52 </p> |
|
53 <h3>Derived from</h3> |
|
54 DebugClientBase.DebugClientBase, AsyncIO |
|
55 <h3>Class Attributes</h3> |
|
56 <table> |
|
57 <tr><td>debugClient</td></tr> |
|
58 </table> |
|
59 <h3>Class Methods</h3> |
|
60 <table> |
|
61 <tr><td>None</td></tr> |
|
62 </table> |
|
63 <h3>Methods</h3> |
|
64 <table> |
|
65 <tr> |
|
66 <td><a href="#DebugClientThreads.__init__">DebugClientThreads</a></td> |
|
67 <td>Constructor</td> |
|
68 </tr><tr> |
|
69 <td><a href="#DebugClientThreads.attachThread">attachThread</a></td> |
|
70 <td>Public method to setup a thread for DebugClient to debug.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#DebugClientThreads.eventLoop">eventLoop</a></td> |
|
73 <td>Public method implementing our event loop.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#DebugClientThreads.lockClient">lockClient</a></td> |
|
76 <td>Public method to acquire the lock for this client.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#DebugClientThreads.setCurrentThread">setCurrentThread</a></td> |
|
79 <td>Public method to set the current thread.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#DebugClientThreads.set_quit">set_quit</a></td> |
|
82 <td>Public method to do a 'set quit' on all threads.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#DebugClientThreads.threadTerminated">threadTerminated</a></td> |
|
85 <td>Public method called when a DebugThread has exited.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#DebugClientThreads.unlockClient">unlockClient</a></td> |
|
88 <td>Public method to release the lock for this client.</td> |
|
89 </tr> |
|
90 </table> |
|
91 <h3>Static Methods</h3> |
|
92 <table> |
|
93 <tr><td>None</td></tr> |
|
94 </table> |
|
95 <a NAME="DebugClientThreads.__init__" ID="DebugClientThreads.__init__"></a> |
|
96 <h4>DebugClientThreads (Constructor)</h4> |
|
97 <b>DebugClientThreads</b>(<i></i>) |
|
98 <p> |
|
99 Constructor |
|
100 </p><a NAME="DebugClientThreads.attachThread" ID="DebugClientThreads.attachThread"></a> |
|
101 <h4>DebugClientThreads.attachThread</h4> |
|
102 <b>attachThread</b>(<i>target=None, args=None, kwargs=None, mainThread=0</i>) |
|
103 <p> |
|
104 Public method to setup a thread for DebugClient to debug. |
|
105 </p><p> |
|
106 If mainThread is non-zero, then we are attaching to the already |
|
107 started mainthread of the app and the rest of the args are ignored. |
|
108 </p><dl> |
|
109 <dt><i>target</i></dt> |
|
110 <dd> |
|
111 the start function of the target thread (i.e. the |
|
112 user code) |
|
113 </dd><dt><i>args</i></dt> |
|
114 <dd> |
|
115 arguments to pass to target |
|
116 </dd><dt><i>kwargs</i></dt> |
|
117 <dd> |
|
118 keyword arguments to pass to target |
|
119 </dd><dt><i>mainThread</i></dt> |
|
120 <dd> |
|
121 non-zero, if we are attaching to the already |
|
122 started mainthread of the app |
|
123 </dd> |
|
124 </dl><dl> |
|
125 <dt>Returns:</dt> |
|
126 <dd> |
|
127 The identifier of the created thread |
|
128 </dd> |
|
129 </dl><a NAME="DebugClientThreads.eventLoop" ID="DebugClientThreads.eventLoop"></a> |
|
130 <h4>DebugClientThreads.eventLoop</h4> |
|
131 <b>eventLoop</b>(<i>disablePolling=False</i>) |
|
132 <p> |
|
133 Public method implementing our event loop. |
|
134 </p><dl> |
|
135 <dt><i>disablePolling</i></dt> |
|
136 <dd> |
|
137 flag indicating to enter an event loop with |
|
138 polling disabled (boolean) |
|
139 </dd> |
|
140 </dl><a NAME="DebugClientThreads.lockClient" ID="DebugClientThreads.lockClient"></a> |
|
141 <h4>DebugClientThreads.lockClient</h4> |
|
142 <b>lockClient</b>(<i>blocking=1</i>) |
|
143 <p> |
|
144 Public method to acquire the lock for this client. |
|
145 </p><dl> |
|
146 <dt><i>blocking</i></dt> |
|
147 <dd> |
|
148 flag to indicating a blocking lock |
|
149 </dd> |
|
150 </dl><dl> |
|
151 <dt>Returns:</dt> |
|
152 <dd> |
|
153 flag indicating successful locking |
|
154 </dd> |
|
155 </dl><a NAME="DebugClientThreads.setCurrentThread" ID="DebugClientThreads.setCurrentThread"></a> |
|
156 <h4>DebugClientThreads.setCurrentThread</h4> |
|
157 <b>setCurrentThread</b>(<i>id</i>) |
|
158 <p> |
|
159 Public method to set the current thread. |
|
160 </p><dl> |
|
161 <dt><i>id</i></dt> |
|
162 <dd> |
|
163 the id the current thread should be set to. |
|
164 </dd> |
|
165 </dl><a NAME="DebugClientThreads.set_quit" ID="DebugClientThreads.set_quit"></a> |
|
166 <h4>DebugClientThreads.set_quit</h4> |
|
167 <b>set_quit</b>(<i></i>) |
|
168 <p> |
|
169 Public method to do a 'set quit' on all threads. |
|
170 </p><a NAME="DebugClientThreads.threadTerminated" ID="DebugClientThreads.threadTerminated"></a> |
|
171 <h4>DebugClientThreads.threadTerminated</h4> |
|
172 <b>threadTerminated</b>(<i>dbgThread</i>) |
|
173 <p> |
|
174 Public method called when a DebugThread has exited. |
|
175 </p><dl> |
|
176 <dt><i>dbgThread</i></dt> |
|
177 <dd> |
|
178 the DebugThread that has exited |
|
179 </dd> |
|
180 </dl><a NAME="DebugClientThreads.unlockClient" ID="DebugClientThreads.unlockClient"></a> |
|
181 <h4>DebugClientThreads.unlockClient</h4> |
|
182 <b>unlockClient</b>(<i></i>) |
|
183 <p> |
|
184 Public method to release the lock for this client. |
|
185 </p> |
|
186 <div align="right"><a href="#top">Up</a></div> |
|
187 <hr /><hr /> |
|
188 <a NAME="_debugclient_start_new_thread" ID="_debugclient_start_new_thread"></a> |
|
189 <h2>_debugclient_start_new_thread</h2> |
|
190 <b>_debugclient_start_new_thread</b>(<i>target, args, kwargs={}</i>) |
|
191 <p> |
|
192 Module function used to allow for debugging of multiple threads. |
|
193 </p><p> |
|
194 The way it works is that below, we reset thread._start_new_thread to |
|
195 this function object. Thus, providing a hook for us to see when |
|
196 threads are started. From here we forward the request onto the |
|
197 DebugClient which will create a DebugThread object to allow tracing |
|
198 of the thread then start up the thread. These actions are always |
|
199 performed in order to allow dropping into debug mode. |
|
200 </p><p> |
|
201 See DebugClientThreads.attachThread and DebugThread.DebugThread in |
|
202 DebugThread.py |
|
203 </p><dl> |
|
204 <dt><i>target</i></dt> |
|
205 <dd> |
|
206 the start function of the target thread (i.e. the user code) |
|
207 </dd><dt><i>args</i></dt> |
|
208 <dd> |
|
209 arguments to pass to target |
|
210 </dd><dt><i>kwargs</i></dt> |
|
211 <dd> |
|
212 keyword arguments to pass to target |
|
213 </dd> |
|
214 </dl><dl> |
|
215 <dt>Returns:</dt> |
|
216 <dd> |
|
217 The identifier of the created thread |
|
218 </dd> |
|
219 </dl> |
|
220 <div align="right"><a href="#top">Up</a></div> |
|
221 <hr /> |
|
222 </body></html> |
|