----- Original Message -----
From: "Johan Compagner" <
jcompagner@xxxxxxxxx>
To: "DLTK Developer list" <
dltk-dev@xxxxxxxxxxx>
Sent: Tuesday, July 8, 2008 10:21:12 PM GMT +06:00 Almaty, Novosibirsk
Subject: [Dltk-dev] The new async code in DbgpDebuggingEngineCommuncatior does lock everything.
I added a view log statements to test this and i see this in the log
Worker-6:: putting request: run -i 9 in map: {}
Worker-4:: putting request: property_set -d -1 -n suspendOnEntry -i 10 -- in map: {run -i 9=run -i 9}
main:: putting request: property_set -d -1 -n suspendOnException -i 11 -- dHJ1ZQ== in map: {run -i 9=run -i 9}
So run is not an Async() command/action
But run will wait for every so then there is suddenly 1 activeRequest in that map
Then 2 other are coming 1 is a worker thread thats then going to wait for ever
then i place a break point and then the main thread also tries to but something in and then the main threads hangs.
So i guess the DbgpContinuationCommands must create a async command:
protected IDbgpStatus execCommand(String command) throws DbgpException {
return DbgpXmlEntityParser
.parseStatus(communicate(createAsyncRequest(command)));
}
The problem is what is really meant to be an Async request and not?
if (request.isAsync()) {
sendRequest(request.toString());
packet = receiveResponse(requestId);
} else {
final long startTime = DEBUG ? System.currentTimeMillis() : 0;
System.err.println(Thread.currentThread().getName()
+ ":: putting request: " + request + " in map: "
+ activeRequests);
synchronized (activeRequests) {
while (!activeRequests.isEmpty()) {
activeRequests.wait();
}
activeRequests.put(request, request);
}
if (DEBUG) {
final long waited = System.currentTimeMillis() - startTime;
if (waited > 0) {
System.out.println("Waited " + waited + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
try {
sendRequest(request.toString());
packet = receiveResponse(requestId);
} finally {
System.err.println(Thread.currentThread().getName()
+ ":: removing request: " + request + " from map: "
+ activeRequests);
synchronized (activeRequests) {
activeRequests.remove(request);
activeRequests.notifyAll();
}
}
}