- diff --git a/ptxdist/local_src/libvt/ECom/ecbinterface.cpp b/ptxdist/local_src/libvt/ECom/ecbinterface.cpp
- index cd3fd19..142b6e9 100644
- --- a/ptxdist/local_src/libvt/ECom/ecbinterface.cpp
- +++ b/ptxdist/local_src/libvt/ECom/ecbinterface.cpp
- @@ -32,6 +32,7 @@
- #include <QByteArray>
- #include <QMutex>
- +#include <QMutexLocker>
- #include <QTime>
- #include <QReadWriteLock>
- #include <QFlags>
- @@ -116,12 +117,14 @@ char* _pReadBuffer=_RxBuffer.data();
- char* _pWriteBuffer=_RxBuffer.data();
- char* _pEndBuffer=(_RxBuffer.data() + RXBUFFER_SIZE_E);
- bool _full(false);
- -QMutex __Lock;
- +
- +static QMutex __Lock(QMutex::Recursive);
- int data_in( char* data, int size){
- int iRet(-1);
- - __Lock.lock();
- + QMutexLocker mylocker(&__Lock);
- +
- if ( _full == true ) {
- // Spezielles Event versenden an GUI-Thread, damit Buffer abgearbeitet wird/gelöscht wird.
- postECbEvent( ECB_FULLEVENT_E );
- @@ -173,7 +176,7 @@ int data_in( char* data, int size){
- _full = true;
- }
- }
- - __Lock.unlock();
- + mylocker.unlock();
- if ( iRet == size ) {
- // Spezielles Event versenden an GUI-Thread, damit Buffer abgearbeitet wird.
- @@ -192,7 +195,7 @@ int data_check(void){
- WORD_UI length;
- length.word = -1;
- - __Lock.lock();
- + QMutexLocker mylocker(&__Lock);
- if ( ( _pReadBuffer != _pWriteBuffer ) || (_full == true) ) {
- @@ -228,21 +231,18 @@ int data_check(void){
- else {
- length.word = 0;
- }
- - __Lock.unlock();
- return length.word;
- }
- void data_clear(void){
- - __Lock.lock();
- + QMutexLocker mylocker(&__Lock);
- // Variablen/Buffer zurücksetzen
- _pReadBuffer=_RxBuffer.data();
- _pWriteBuffer=_RxBuffer.data();
- _pEndBuffer=(_RxBuffer.data() + RXBUFFER_SIZE_E);
- _full = false;
- -
- - __Lock.unlock();
- }
- int data_out( char* data, int size){
- @@ -250,7 +250,7 @@ int data_out( char* data, int size){
- WORD_UI length;
- int iRet = 0;
- - __Lock.lock();
- + QMutexLocker mylocker(&__Lock);
- length.word = -1;
- if ( (_pReadBuffer != _pWriteBuffer) || (_full==true) ) {
- @@ -304,7 +304,7 @@ int data_out( char* data, int size){
- _pReadBuffer = _RxBuffer.data();
- }
- }
- - __Lock.unlock();
- + mylocker.unlock();
- if ( (iRet < 0) || (iRet != size) ) {
- // Beim Schreiben kam es zu einem Fehler
quantron prototype-fix codesysapp-Hänger
Posted by Anonymous on Thu 17th Jan 2019 14:26
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.