I need realize critical section in Qt (4.7.3, Windows XP).
For example, public slot:
void MyClass::myPublicSlot(...local params...)
{
...
block of code working with global params;
...
}
Function void myPublicSlot starts by timer.
Performing the function may take a long time, sometimes more than timer tick(or, for example, button click).
Need to lock block of code working with global params.
Function call can be as multi-threaded and single-threaded.
P.S. I tried using of QMutex and QMutexLocker, but its cause deadlock in single-threaded case.
QMutexis what you want. Perhaps you are using it recursively but not creating a recursive mutex? That’s the only explanation for a deadlock in single thread code.