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