mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-12 16:15:43 -04:00
TokenQueue:
- fixed stop of TokenQueue polling when events are locked RsProtectedTimer: - switched to faster poll when events are locked git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6507 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4edcec6fe9
commit
f4ee02bb01
4 changed files with 36 additions and 34 deletions
|
@ -24,17 +24,27 @@
|
|||
|
||||
#include "RsProtectedTimer.h"
|
||||
|
||||
#define TIMER_FAST_POLL 499 // unique time in RetroShare
|
||||
|
||||
//#define PROTECTED_TIMER_DEBUG
|
||||
|
||||
RsProtectedTimer::RsProtectedTimer(QObject *parent)
|
||||
: QTimer(parent)
|
||||
{
|
||||
mInterval = 0;
|
||||
}
|
||||
|
||||
void RsProtectedTimer::timerEvent(QTimerEvent *e)
|
||||
{
|
||||
if(RsAutoUpdatePage::eventsLocked())
|
||||
{
|
||||
if (!mInterval && interval() > TIMER_FAST_POLL) {
|
||||
/* Save interval */
|
||||
mInterval = interval();
|
||||
/* Set fast interval */
|
||||
setInterval(TIMER_FAST_POLL); // restart timer
|
||||
}
|
||||
|
||||
#ifdef PROTECTED_TIMER_DEBUG
|
||||
if (isSingleShot()) {
|
||||
/* Singleshot timer will be stopped in QTimer::timerEvent */
|
||||
|
@ -56,4 +66,15 @@ void RsProtectedTimer::timerEvent(QTimerEvent *e)
|
|||
#endif
|
||||
|
||||
QTimer::timerEvent(e) ;
|
||||
|
||||
if (mInterval) {
|
||||
if (interval() == TIMER_FAST_POLL) {
|
||||
/* Still fast poll */
|
||||
if (!isSingleShot()) {
|
||||
/* Restore interval */
|
||||
setInterval(mInterval); // restart timer
|
||||
}
|
||||
}
|
||||
mInterval = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue