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