- diff --git a/ptxdist/local_src/libvt/ECom/ecbinterface.cpp b/ptxdist/local_src/libvt/ECom/ecbinterface.cpp
- index cd3fd19..3b23009 100644
- --- a/ptxdist/local_src/libvt/ECom/ecbinterface.cpp
- +++ b/ptxdist/local_src/libvt/ECom/ecbinterface.cpp
- @@ -36,6 +36,9 @@
- #include <QReadWriteLock>
- #include <QFlags>
- +#include <signal.h>
- +#include <pthread.h>
- +
- /************************************************************************/
- /* here: Defines */
- /************************************************************************/
- @@ -118,10 +121,35 @@ char* _pEndBuffer=(_RxBuffer.data() + RXBUFFER_SIZE_E);
- bool _full(false);
- QMutex __Lock;
- +
- +#if 1
- +
- +static pthread_once_t init_sigrtmask_once = PTHREAD_ONCE_INIT;
- +static sigset_t block_sigrtset;
- +
- +static void initblocksigmask(void)
- +{
- + int i;
- +
- + (void)sigemptyset(&block_sigrtset);
- +
- + /* fixme: We should use getconf RTSIG_MAX */
- + for (i=0 ; i < 32 ; i++)
- + (void)sigaddset(&block_sigrtset, SIGRTMIN+i);
- +}
- +
- +#define __Lock_LOCK { pthread_once(&init_sigrtmask_once, initblocksigmask); pthread_sigmask(SIG_BLOCK, &block_sigrtset, NULL); __Lock.lock(); }
- +#define __Lock_UNLOCK { __Lock.unlock(); pthread_sigmask(SIG_UNBLOCK, &block_sigrtset, NULL); }
- +
- +#else
- +#define __Lock_LOCK __Lock.lock()
- +#define __Lock_UNLOCK __Lock.unlock()
- +#endif
- +
- int data_in( char* data, int size){
- int iRet(-1);
- - __Lock.lock();
- + __Lock_LOCK;
- if ( _full == true ) {
- // Spezielles Event versenden an GUI-Thread, damit Buffer abgearbeitet wird/gelöscht wird.
- postECbEvent( ECB_FULLEVENT_E );
- @@ -173,7 +201,7 @@ int data_in( char* data, int size){
- _full = true;
- }
- }
- - __Lock.unlock();
- + __Lock_UNLOCK;
- if ( iRet == size ) {
- // Spezielles Event versenden an GUI-Thread, damit Buffer abgearbeitet wird.
- @@ -192,7 +220,7 @@ int data_check(void){
- WORD_UI length;
- length.word = -1;
- - __Lock.lock();
- + __Lock_LOCK;
- if ( ( _pReadBuffer != _pWriteBuffer ) || (_full == true) ) {
- @@ -228,13 +256,13 @@ int data_check(void){
- else {
- length.word = 0;
- }
- - __Lock.unlock();
- + __Lock_UNLOCK;
- return length.word;
- }
- void data_clear(void){
- - __Lock.lock();
- + __Lock_LOCK;
- // Variablen/Buffer zurücksetzen
- _pReadBuffer=_RxBuffer.data();
- @@ -242,7 +270,7 @@ void data_clear(void){
- _pEndBuffer=(_RxBuffer.data() + RXBUFFER_SIZE_E);
- _full = false;
- - __Lock.unlock();
- + __Lock_UNLOCK;
- }
- int data_out( char* data, int size){
- @@ -250,7 +278,7 @@ int data_out( char* data, int size){
- WORD_UI length;
- int iRet = 0;
- - __Lock.lock();
- + __Lock_LOCK;
- length.word = -1;
- if ( (_pReadBuffer != _pWriteBuffer) || (_full==true) ) {
- @@ -304,7 +332,7 @@ int data_out( char* data, int size){
- _pReadBuffer = _RxBuffer.data();
- }
- }
- - __Lock.unlock();
- + __Lock_UNLOCK;
- if ( (iRet < 0) || (iRet != size) ) {
- // Beim Schreiben kam es zu einem Fehler
quantron libvt defer RT signals bevor trying to obtain the QMutex
Posted by Anonymous on Thu 17th Jan 2019 10:06
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.