mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
Fix a deadlock in CallbackServer.java.
-Manifested when running mobile spec. Was caused by CallbackServer obtaining lock #1 then #2, while other thread obtained #2 then #1.
This commit is contained in:
parent
302d51cdfd
commit
0baf104a75
@ -211,14 +211,14 @@ public class CallbackServer implements Runnable {
|
|||||||
|
|
||||||
// Wait until there is some data to send, or send empty data every 10 sec
|
// Wait until there is some data to send, or send empty data every 10 sec
|
||||||
// to prevent XHR timeout on the client
|
// to prevent XHR timeout on the client
|
||||||
synchronized (this) {
|
while (this.active) {
|
||||||
while (this.active) {
|
if (jsMessageQueue != null) {
|
||||||
if (jsMessageQueue != null) {
|
payload = jsMessageQueue.popAndEncode();
|
||||||
payload = jsMessageQueue.popAndEncode();
|
if (payload != null) {
|
||||||
if (payload != null) {
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
synchronized (this) {
|
||||||
try {
|
try {
|
||||||
this.wait(10000); // prevent timeout from happening
|
this.wait(10000); // prevent timeout from happening
|
||||||
//Log.d(LOG_TAG, "CallbackServer>>> break <<<");
|
//Log.d(LOG_TAG, "CallbackServer>>> break <<<");
|
||||||
|
Loading…
Reference in New Issue
Block a user