From 1a4e3c8d44f38530b8bd02fd054a6e8b672e357f Mon Sep 17 00:00:00 2001 From: vassilis Date: Wed, 14 Apr 2010 01:01:35 +0000 Subject: [PATCH] OP-4 Flight/UAVTalk Minor type fixes git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@498 ebee16cc-31ac-478f-84a7-5cbb03baadba --- ground/src/plugins/uavtalk/uavtalk.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/src/plugins/uavtalk/uavtalk.cpp b/ground/src/plugins/uavtalk/uavtalk.cpp index 8baf953cb..8e24203d1 100644 --- a/ground/src/plugins/uavtalk/uavtalk.cpp +++ b/ground/src/plugins/uavtalk/uavtalk.cpp @@ -109,12 +109,12 @@ bool UAVTalk::objectTransaction(UAVObject* obj, quint8 type, qint32 timeoutMs, b // Send object depending on if a response is needed if (type == TYPE_OBJ_ACK || type == TYPE_OBJ_REQ) { + respSema->tryAcquire(); // non blocking call to make sure the value is zero (binary sema) if ( transmitObject(obj, type, allInstances) ) { respObj = obj; respAllInstances = allInstances; - mutex->unlock(); // need to release lock since the next call will block until a response is received - respSema->tryAcquire(); // the semaphore needs to block on the next call, here we make sure the value is zero (binary sema) + mutex->unlock(); // need to release lock since the next call will block until a response is received respReceived = respSema->tryAcquire(1, timeoutMs); // lock on object until a response is received (or timeout) return respReceived; }