I use timer in my program:timer = new Qtimer(); connect(timer, SIGNAL(timeout()), this, SLOT(readData()));
timer.start(1000);
And there is also other slots which may be triggered by UI interation:/*SLOT FUNCTION*/ on_pushbutton_triggered(){..../*write data*/...}
.
(the code is written in qt, but I think it's a common question)
So I worry about the potential problem: may readData() reads wrong data while on_pushbutton_triggereed() is writting data?
I am not so familiar with how the timer really work behind the screen: is it in the same thread with my program?
Will readData() and on_pushbutton_triggereed() be called, executed, finished serially and have no mutex problem(that is: I have to use lock() and unlock())? Thank you for reading! I really hope for your hints!