1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +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 335ccc54a3
commit 785cda8052

View File

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