1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

AndroidGCS: Add back a few synchronize blocks in telemetry to avoid removing

elements twice.
This commit is contained in:
James Cotton 2012-08-12 17:21:40 -05:00
parent cf4dbe2b07
commit e43651e57e

View File

@ -551,17 +551,22 @@ public class Telemetry {
// Get object information from queue (first the priority and then the regular queue) // Get object information from queue (first the priority and then the regular queue)
ObjectQueueInfo objInfo; ObjectQueueInfo objInfo;
if ( !objPriorityQueue.isEmpty() ) synchronized (objPriorityQueue) {
{ if ( !objPriorityQueue.isEmpty() )
objInfo = objPriorityQueue.remove(); {
} objInfo = objPriorityQueue.remove();
else if ( !objQueue.isEmpty() ) } else {
{ synchronized (objQueue) {
objInfo = objQueue.remove(); if ( !objQueue.isEmpty() )
} {
else objInfo = objQueue.remove();
{ }
return; else
{
return;
}
}
}
} }
// Check if a connection has been established, only process GCSTelemetryStats updates // Check if a connection has been established, only process GCSTelemetryStats updates