# HG changeset patch # User Jeandet Alexis # Date 2015-09-15 07:03:48 # Node ID 039eabb0d39f65729e56399fb092c0d33eaff781 # Parent 7fec6dc84917ffe3ec0c814e57a5ae9927ee6830 Added missing threading protections diff --git a/spwplugin/StarDundee/stardundeespw_usb.cpp b/spwplugin/StarDundee/stardundeespw_usb.cpp --- a/spwplugin/StarDundee/stardundeespw_usb.cpp +++ b/spwplugin/StarDundee/stardundeespw_usb.cpp @@ -1029,7 +1029,6 @@ bool stardundeeSPW_USB_Manager::sendPack SocExplorerEngine::message(this->plugin,"Packet sent",2); } -// this->handleMutex->unlock(); return true; } @@ -1045,6 +1044,7 @@ void stardundeeSPW_USB_Manager::pushRmap void stardundeeSPW_USB_Manager::sendTimecodePeriodically( bool onOff ) { + this->handleMutex->lock(); if (onOff == true) { if (!USBSpaceWire_TC_EnableAutoTickIn(hDevice, 1, 1)) @@ -1055,6 +1055,7 @@ void stardundeeSPW_USB_Manager::sendTime if (!USBSpaceWire_TC_EnableAutoTickIn(hDevice, 0, 0)) SocExplorerEngine::message(this->plugin,"Could not disable auto tick-in"); } + this->handleMutex->unlock(); } int stardundeeSPW_USB_Manager::getLinkNumber( void ) @@ -1069,6 +1070,7 @@ void stardundeeSPW_USB_Manager::setTimec double freqCountInDouble=0.0; double currentFrequency=0.0; + this->handleMutex->lock(); rtr_clk_freq = USBSpaceWire_TC_GetClockFrequency(hDevice); freqCountInDouble = ((double) rtr_clk_freq) / requestedFrequency; freqCount = (unsigned int) freqCountInDouble; @@ -1082,10 +1084,12 @@ void stardundeeSPW_USB_Manager::setTimec else SocExplorerEngine::message(this->plugin,"tick frequency set to " + QString::number(currentFrequency) +" Hz" + " (freqCount set to " + QString::number(freqCount) + ")" ); + this->handleMutex->unlock(); } void stardundeeSPW_USB_Manager::sendOneTimecode( unsigned char nTimein ) { + this->handleMutex->lock(); // enable external timecode selection if(!USBSpaceWire_TC_EnableExternalTimecodeSelection(hDevice,1)) SocExplorerEngine::message(this->plugin,"sendOneTimecode *** ERR *** enable external timecode selection"); @@ -1098,6 +1102,7 @@ void stardundeeSPW_USB_Manager::sendOneT // disable external timecode selection if(!USBSpaceWire_TC_EnableExternalTimecodeSelection(hDevice,0)) SocExplorerEngine::message(this->plugin,"sendOneTimecode *** ERR *** disable external timecode selection"); + this->handleMutex->unlock(); }