PUD: only use transmitGpsInformation while mutex is locked
authorFerry Huberts <f.huberts@mindef.nl>
Mon, 18 Jul 2011 07:56:46 +0000 (09:56 +0200)
committerFerry Huberts <f.huberts@mindef.nl>
Tue, 19 Jul 2011 11:02:12 +0000 (13:02 +0200)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/receiver.c

index 71f7582..6611812 100644 (file)
@@ -699,14 +699,15 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) {
                memcpy(&transmitGpsInformation.txPosition.nmeaInfo,
                                &posAvgEntry->nmeaInfo, sizeof(nmeaINFO));
                transmitGpsInformation.updated = true;
-               (void) pthread_mutex_unlock(&transmitGpsInformation.mutex);
-       }
 
 #if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&transmitGpsInformation.txPosition.nmeaInfo,
+               dump_nmeaInfo(&transmitGpsInformation.txPosition.nmeaInfo,
                        "receiverUpdateGpsInformation: transmitGpsInformation");
 #endif /* PUD_DUMP_AVERAGING */
 
+               (void) pthread_mutex_unlock(&transmitGpsInformation.mutex);
+       }
+
        if (updateTransmitGpsInformation) {
                if (!restartOlsrTxTimer(
                                (state.externalState == STATIONARY) ? getUpdateIntervalStationary()