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:
parent
335ccc54a3
commit
785cda8052
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user