Krita Source Code Documentation
Loading...
Searching...
No Matches
KisUpdateScheduler Class Reference

#include <kis_update_scheduler.h>

+ Inheritance diagram for KisUpdateScheduler:

Public Member Functions

void addJob (KisStrokeId id, KisStrokeJobData *data) override
 
void addSpontaneousJob (KisSpontaneousJob *spontaneousJob)
 
qreal balancingRatio () const
 
void barrierLock ()
 
void blockUpdates ()
 
bool cancelStroke (KisStrokeId id) override
 
void continueUpdate (const QRect &rect)
 
int currentLevelOfDetail () const
 
void doSomeUsefulWork ()
 
void endStroke (KisStrokeId id) override
 
void explicitRegenerateLevelOfDetail ()
 
void fullRefreshAsync (KisNodeSP root, const QRect &rc, const QRect &cropRect)
 
void fullRefreshAsync (KisNodeSP root, const QVector< QRect > &rects, const QRect &cropRect, KisProjectionUpdateFlags flags)
 
bool hasUpdatesRunning () const
 
void immediateLockForReadOnly ()
 
bool isIdle ()
 
 KisUpdateScheduler (KisProjectionUpdateListener *projectionUpdateListener, QObject *parent=0)
 
KisPostExecutionUndoAdapterlodNPostExecutionUndoAdapter () const
 
KisLodPreferences lodPreferences () const
 
 Private (KisUpdateScheduler *_q, KisProjectionUpdateListener *p)
 
void setLod0ToNStrokeStrategyFactory (const KisLodSyncStrokeStrategyFactory &factory)
 
void setLodPreferences (const KisLodPreferences &value)
 
void setPostSyncLod0GUIPlaneRequestForResumeCallback (const std::function< void()> &callback)
 
void setProgressProxy (KoProgressProxy *progressProxy)
 
void setPurgeRedoStateCallback (const std::function< void()> &callback)
 
void setSuspendResumeUpdatesStrokeStrategyFactory (const KisSuspendResumeStrategyPairFactory &factory)
 
void setThreadsLimit (int value)
 
void spareThreadAppeared ()
 
KisStrokeId startStroke (KisStrokeStrategy *strokeStrategy) override
 
int threadsLimit () const
 
bool tryBarrierLock ()
 
bool tryCancelCurrentStrokeAsync ()
 
UndoResult tryUndoLastStrokeAsync ()
 
void unblockUpdates ()
 
void unlock (bool resetLodLevels=true)
 
void updateProjection (KisNodeSP node, const QRect &rc, const QRect &cropRect)
 
void updateProjection (KisNodeSP node, const QVector< QRect > &rects, const QRect &cropRect, KisProjectionUpdateFlags flags)
 
void waitForDone ()
 
bool wrapAroundModeSupported () const
 
 ~KisUpdateScheduler () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- Public Member Functions inherited from KisStrokesFacade
virtual ~KisStrokesFacade ()
 

Public Attributes

qreal defaultBalancingRatio = 1.0
 
bool processingBlocked = false
 
KisQueuesProgressUpdaterprogressUpdater = 0
 
KisProjectionUpdateListenerprojectionUpdateListener
 
KisUpdateSchedulerq
 
KisStrokesQueue strokesQueue
 
KisUpdaterContext updaterContext
 
KisLazyWaitCondition updatesFinishedCondition
 
QAtomicInt updatesLockCounter
 
KisSimpleUpdateQueue updatesQueue
 
QReadWriteLock updatesStartLock
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Protected Slots

void updateSettings ()
 

Protected Member Functions

void connectSignals ()
 
 KisUpdateScheduler ()
 
void processQueues ()
 

Protected Attributes

Private *const m_d
 

Private Member Functions

bool haveUpdatesRunning ()
 
void progressUpdate ()
 
void tryProcessUpdatesQueue ()
 
void wakeUpWaitingThreads ()
 

Friends

class UpdatesBlockTester
 

Detailed Description

Definition at line 38 of file kis_update_scheduler.cpp.

Constructor & Destructor Documentation

◆ KisUpdateScheduler() [1/2]

KisUpdateScheduler::KisUpdateScheduler ( KisProjectionUpdateListener * projectionUpdateListener,
QObject * parent = 0 )

Definition at line 65 of file kis_update_scheduler.cpp.

66 : QObject(parent),
68{
71}
KisProjectionUpdateListener * projectionUpdateListener

References connectSignals(), and updateSettings().

◆ ~KisUpdateScheduler()

KisUpdateScheduler::~KisUpdateScheduler ( )
override

Definition at line 78 of file kis_update_scheduler.cpp.

79{
80 delete m_d->progressUpdater;
81 delete m_d;
82}

References m_d.

◆ KisUpdateScheduler() [2/2]

KisUpdateScheduler::KisUpdateScheduler ( )
protected

Definition at line 73 of file kis_update_scheduler.cpp.

74 : m_d(new Private(this, 0))
75{
76}

Member Function Documentation

◆ addJob()

void KisUpdateScheduler::addJob ( KisStrokeId id,
KisStrokeJobData * data )
overridevirtual

Implements KisStrokesFacade.

Definition at line 181 of file kis_update_scheduler.cpp.

182{
183 m_d->strokesQueue.addJob(id, data);
185}

References m_d, and processQueues().

◆ addSpontaneousJob()

void KisUpdateScheduler::addSpontaneousJob ( KisSpontaneousJob * spontaneousJob)

Definition at line 163 of file kis_update_scheduler.cpp.

164{
165 m_d->updatesQueue.addSpontaneousJob(spontaneousJob);
167}

References m_d, and processQueues().

◆ balancingRatio()

qreal KisUpdateScheduler::balancingRatio ( ) const
inline

Definition at line 59 of file kis_update_scheduler.cpp.

59 {
60 const qreal strokeRatioOverride = strokesQueue.balancingRatioOverride();
61 return strokeRatioOverride > 0 ? strokeRatioOverride : defaultBalancingRatio;
62 }

References KisStrokesQueue::balancingRatioOverride.

◆ barrierLock()

void KisUpdateScheduler::barrierLock ( )

Waits until the queues become empty, then blocks the processing. To unblock processing you should use unlock().

If some other thread adds jobs in parallel, then you may wait forever. If you don't want it, consider lock() instead.

See also
unlock(), lock()

Definition at line 346 of file kis_update_scheduler.cpp.

347{
348 do {
349 m_d->processingBlocked = false;
351 m_d->processingBlocked = true;
352 m_d->updaterContext.waitForDone();
353 } while(!m_d->updatesQueue.isEmpty() || !m_d->strokesQueue.isEmpty());
354}

References m_d, and processQueues().

◆ blockUpdates()

void KisUpdateScheduler::blockUpdates ( )

Blocks all the updates from execution. It doesn't affect strokes execution in any way. This type of lock is supposed to be held by the strokes themselves when they need a short access to some parts of the projection of the image.

From all the other places you should use usual lock()/unlock() methods

See also
lock(), unlock()

Definition at line 388 of file kis_update_scheduler.cpp.

389{
390 m_d->updatesFinishedCondition.initWaiting();
391
392 m_d->updatesLockCounter.ref();
393 while(haveUpdatesRunning()) {
394 m_d->updatesFinishedCondition.wait();
395 }
396
397 m_d->updatesFinishedCondition.endWaiting();
398}

References haveUpdatesRunning(), and m_d.

◆ cancelStroke()

bool KisUpdateScheduler::cancelStroke ( KisStrokeId id)
overridevirtual

Implements KisStrokesFacade.

Definition at line 193 of file kis_update_scheduler.cpp.

194{
195 bool result = m_d->strokesQueue.cancelStroke(id);
197 return result;
198}

References m_d, and processQueues().

◆ connectSignals()

void KisUpdateScheduler::connectSignals ( )
protected

Definition at line 106 of file kis_update_scheduler.cpp.

107{
108 connect(KisImageConfigNotifier::instance(), SIGNAL(configChanged()),
109 SLOT(updateSettings()));
110}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
static KisImageConfigNotifier * instance()

References connect(), KisImageConfigNotifier::instance(), and updateSettings().

◆ continueUpdate()

void KisUpdateScheduler::continueUpdate ( const QRect & rect)

Definition at line 431 of file kis_update_scheduler.cpp.

432{
433 Q_ASSERT(m_d->projectionUpdateListener);
434 m_d->projectionUpdateListener->notifyProjectionUpdated(rect);
435}

References m_d.

◆ currentLevelOfDetail()

int KisUpdateScheduler::currentLevelOfDetail ( ) const

Definition at line 240 of file kis_update_scheduler.cpp.

241{
242 int levelOfDetail = m_d->updaterContext.currentLevelOfDetail();
243
244 if (levelOfDetail < 0) {
245 // it is safe, because is called iff updaterContext has no running jobs at all
246 levelOfDetail = m_d->updatesQueue.overrideLevelOfDetail();
247 }
248
249 if (levelOfDetail < 0) {
250 levelOfDetail = 0;
251 }
252
253 return levelOfDetail;
254}

References m_d.

◆ doSomeUsefulWork()

void KisUpdateScheduler::doSomeUsefulWork ( )

Definition at line 437 of file kis_update_scheduler.cpp.

438{
439 m_d->updatesQueue.optimize();
440}

References m_d.

◆ endStroke()

void KisUpdateScheduler::endStroke ( KisStrokeId id)
overridevirtual

Implements KisStrokesFacade.

Definition at line 187 of file kis_update_scheduler.cpp.

188{
189 m_d->strokesQueue.endStroke(id);
191}

References m_d, and processQueues().

◆ explicitRegenerateLevelOfDetail()

void KisUpdateScheduler::explicitRegenerateLevelOfDetail ( )

Explicitly start regeneration of LoD planes of all the devices in the image. This call should be performed when the user is idle, just to make the quality of image updates better.

Definition at line 232 of file kis_update_scheduler.cpp.

233{
234 m_d->strokesQueue.explicitRegenerateLevelOfDetail();
235
236 // \see a comment in setDesiredLevelOfDetail()
238}

References m_d, and processQueues().

◆ fullRefreshAsync() [1/2]

void KisUpdateScheduler::fullRefreshAsync ( KisNodeSP root,
const QRect & rc,
const QRect & cropRect )

Definition at line 158 of file kis_update_scheduler.cpp.

159{
160 fullRefreshAsync(root, {rc}, cropRect, KisProjectionUpdateFlag::None);
161}
void fullRefreshAsync(KisNodeSP root, const QVector< QRect > &rects, const QRect &cropRect, KisProjectionUpdateFlags flags)

References fullRefreshAsync(), and None.

◆ fullRefreshAsync() [2/2]

void KisUpdateScheduler::fullRefreshAsync ( KisNodeSP root,
const QVector< QRect > & rects,
const QRect & cropRect,
KisProjectionUpdateFlags flags )

Definition at line 147 of file kis_update_scheduler.cpp.

148{
149 m_d->updatesQueue.addFullRefreshJob(root, rects, cropRect, currentLevelOfDetail(), flags);
151}

References currentLevelOfDetail(), m_d, and processQueues().

◆ hasUpdatesRunning()

bool KisUpdateScheduler::hasUpdatesRunning ( ) const

Definition at line 169 of file kis_update_scheduler.cpp.

170{
171 return !m_d->updatesQueue.isEmpty();
172}

References m_d.

◆ haveUpdatesRunning()

bool KisUpdateScheduler::haveUpdatesRunning ( )
private

Definition at line 421 of file kis_update_scheduler.cpp.

422{
423 QWriteLocker locker(&m_d->updatesStartLock);
424
425 qint32 numMergeJobs, numStrokeJobs;
426 m_d->updaterContext.getJobsSnapshot(numMergeJobs, numStrokeJobs);
427
428 return numMergeJobs;
429}

References m_d.

◆ immediateLockForReadOnly()

void KisUpdateScheduler::immediateLockForReadOnly ( )

Blocks processing of the queues. The function will wait until all the executing jobs are finished. NOTE: you may add new jobs while the block held, but they will be delayed until unlock() is called.

See also
unlock()

Definition at line 289 of file kis_update_scheduler.cpp.

290{
291 m_d->processingBlocked = true;
292 m_d->updaterContext.waitForDone();
293}

References m_d.

◆ isIdle()

bool KisUpdateScheduler::isIdle ( )

Tells if there are no strokes or updates are running at the moment. Internally calls to tryBarrierLock(), so it is not O(1).

Definition at line 309 of file kis_update_scheduler.cpp.

310{
311 bool result = false;
312
313 if (tryBarrierLock()) {
314 result = true;
315 unlock(false);
316 }
317
318 return result;
319}
void unlock(bool resetLodLevels=true)

References tryBarrierLock(), and unlock().

◆ lodNPostExecutionUndoAdapter()

KisPostExecutionUndoAdapter * KisUpdateScheduler::lodNPostExecutionUndoAdapter ( ) const

Definition at line 276 of file kis_update_scheduler.cpp.

277{
278 return m_d->strokesQueue.lodNPostExecutionUndoAdapter();
279}

References m_d.

◆ lodPreferences()

KisLodPreferences KisUpdateScheduler::lodPreferences ( ) const

Return current lod preferences loaded in the strokes queue

Definition at line 227 of file kis_update_scheduler.cpp.

228{
229 return m_d->strokesQueue.lodPreferences();
230}

References m_d.

◆ Private()

KisUpdateScheduler::Private ( KisUpdateScheduler * _q,
KisProjectionUpdateListener * p )
inline

Definition at line 39 of file kis_update_scheduler.cpp.

40 : q(_q)
41 , updaterContext(KisImageConfig(true).maxNumberOfThreads(), q)
43 {}
const Params2D p
KisUpdaterContext updaterContext
KisUpdateScheduler * q

◆ processQueues()

void KisUpdateScheduler::processQueues ( )
protected

Definition at line 356 of file kis_update_scheduler.cpp.

357{
359
360 if(m_d->processingBlocked) return;
361
362 if(m_d->strokesQueue.needsExclusiveAccess()) {
363 DEBUG_BALANCING_METRICS("STROKES", "X");
364 m_d->strokesQueue.processQueue(m_d->updaterContext,
365 !m_d->updatesQueue.isEmpty());
366
367 if(!m_d->strokesQueue.needsExclusiveAccess()) {
369 }
370 }
371 else if(m_d->balancingRatio() * m_d->strokesQueue.sizeMetric() > m_d->updatesQueue.sizeMetric()) {
372 DEBUG_BALANCING_METRICS("STROKES", "N");
373 m_d->strokesQueue.processQueue(m_d->updaterContext,
374 !m_d->updatesQueue.isEmpty());
376 }
377 else {
378 DEBUG_BALANCING_METRICS("UPDATES", "N");
380 m_d->strokesQueue.processQueue(m_d->updaterContext,
381 !m_d->updatesQueue.isEmpty());
382
383 }
384
386}
#define DEBUG_BALANCING_METRICS(decidedFirst, excl)

References DEBUG_BALANCING_METRICS, m_d, progressUpdate(), tryProcessUpdatesQueue(), and wakeUpWaitingThreads().

◆ progressUpdate()

void KisUpdateScheduler::progressUpdate ( )
private

Definition at line 119 of file kis_update_scheduler.cpp.

120{
121 if (!m_d->progressUpdater) return;
122
123 if(!m_d->strokesQueue.hasOpenedStrokes()) {
124 QString jobName = m_d->strokesQueue.currentStrokeName().toString();
125 if(jobName.isEmpty()) {
126 jobName = i18n("Updating...");
127 }
128
129 int sizeMetric = m_d->strokesQueue.sizeMetric();
130 if (!sizeMetric) {
131 sizeMetric = m_d->updatesQueue.sizeMetric();
132 }
133
134 m_d->progressUpdater->updateProgress(sizeMetric, jobName);
135 }
136 else {
137 m_d->progressUpdater->hide();
138 }
139}

References m_d.

◆ setLod0ToNStrokeStrategyFactory()

void KisUpdateScheduler::setLod0ToNStrokeStrategyFactory ( const KisLodSyncStrokeStrategyFactory & factory)

Install a factory of a stroke strategy, that will be started every time when the scheduler needs to synchronize LOD caches of all the paint devices of the image.

Definition at line 256 of file kis_update_scheduler.cpp.

257{
258 m_d->strokesQueue.setLod0ToNStrokeStrategyFactory(factory);
259}

References m_d.

◆ setLodPreferences()

void KisUpdateScheduler::setLodPreferences ( const KisLodPreferences & value)

Sets the desired level of detail preferences on which the strokes should work. Please note that this configuration will be applied starting from the next stroke. Please also note that this value is not guaranteed to coincide with the one returned by currentLevelOfDetail()

The queue might have started an internal stroke for cache synchronization. Process the queues to execute it if needed.

Definition at line 215 of file kis_update_scheduler.cpp.

216{
217 m_d->strokesQueue.setLodPreferences(value);
218
225}
float value(const T *src, size_t ch)

References m_d, processQueues(), and value().

◆ setPostSyncLod0GUIPlaneRequestForResumeCallback()

void KisUpdateScheduler::setPostSyncLod0GUIPlaneRequestForResumeCallback ( const std::function< void()> & callback)

Sets a callback that is called bu the scheduler when it thinks that Lod0 tiles in the GUI should be refetched by the GUI. Such situation happens in cases when a Lod0 stroke has been cancelled, after its LodN buddy has managed to do some manipulations on the canvas. Without this call the GUI will still contain LodN tiles active.

Definition at line 271 of file kis_update_scheduler.cpp.

272{
273 m_d->strokesQueue.setPostSyncLod0GUIPlaneRequestForResumeCallback(callback);
274}

References m_d.

◆ setProgressProxy()

void KisUpdateScheduler::setProgressProxy ( KoProgressProxy * progressProxy)

Sets the proxy that is going to be notified about the progress of processing of the queues. If you want to switch the proxy on runtime, you should do it under the lock held.

See also
lock(), unlock()

Definition at line 112 of file kis_update_scheduler.cpp.

113{
114 delete m_d->progressUpdater;
115 m_d->progressUpdater = progressProxy ?
116 new KisQueuesProgressUpdater(progressProxy, this) : 0;
117}

References m_d.

◆ setPurgeRedoStateCallback()

void KisUpdateScheduler::setPurgeRedoStateCallback ( const std::function< void()> & callback)

Sets a callback that is called by the scheduler in the beginning of every stroke that declared the necessity of the redo state clearance.

Definition at line 266 of file kis_update_scheduler.cpp.

267{
268 m_d->strokesQueue.setPurgeRedoStateCallback(callback);
269}

References m_d.

◆ setSuspendResumeUpdatesStrokeStrategyFactory()

void KisUpdateScheduler::setSuspendResumeUpdatesStrokeStrategyFactory ( const KisSuspendResumeStrategyPairFactory & factory)

Install a factory of a stroke strategies, that will be started every time when the scheduler needs to postpone/resume all the updates of the LOD0 strokes.

Definition at line 261 of file kis_update_scheduler.cpp.

262{
263 m_d->strokesQueue.setSuspendResumeUpdatesStrokeStrategyFactory(factory);
264}

References m_d.

◆ setThreadsLimit()

void KisUpdateScheduler::setThreadsLimit ( int value)

Set the number of threads used by the scheduler

Thread limit can be changed without the full-featured barrier lock, we can avoid waiting for all the jobs to complete. We should just ensure there is no more jobs in the updater context.

Definition at line 84 of file kis_update_scheduler.cpp.

85{
86 KIS_SAFE_ASSERT_RECOVER_RETURN(!m_d->processingBlocked);
87
94 m_d->updaterContext.lock();
95 m_d->updaterContext.setThreadsLimit(value);
96 m_d->updaterContext.unlock();
97 unlock(false);
98}
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128

References immediateLockForReadOnly(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_d, unlock(), and value().

◆ spareThreadAppeared()

void KisUpdateScheduler::spareThreadAppeared ( )

Definition at line 442 of file kis_update_scheduler.cpp.

443{
445}

References processQueues().

◆ startStroke()

KisStrokeId KisUpdateScheduler::startStroke ( KisStrokeStrategy * strokeStrategy)
overridevirtual

Implements KisStrokesFacade.

Definition at line 174 of file kis_update_scheduler.cpp.

175{
176 KisStrokeId id = m_d->strokesQueue.startStroke(strokeStrategy);
178 return id;
179}

References m_d, and processQueues().

◆ threadsLimit()

int KisUpdateScheduler::threadsLimit ( ) const

Return the number of threads available to the scheduler

Definition at line 100 of file kis_update_scheduler.cpp.

101{
102 std::lock_guard<KisUpdaterContext> l(m_d->updaterContext);
103 return m_d->updaterContext.threadsLimit();
104}

References m_d.

◆ tryBarrierLock()

bool KisUpdateScheduler::tryBarrierLock ( )

Works like barrier lock, but returns false immediately if barrierLock can't be acquired.

See also
barrierLock()

Definition at line 329 of file kis_update_scheduler.cpp.

330{
331 if(!m_d->updatesQueue.isEmpty() || !m_d->strokesQueue.isEmpty()) {
332 return false;
333 }
334
335 m_d->processingBlocked = true;
336 m_d->updaterContext.waitForDone();
337 if(!m_d->updatesQueue.isEmpty() || !m_d->strokesQueue.isEmpty()) {
338 m_d->processingBlocked = false;
340 return false;
341 }
342
343 return true;
344}

References m_d, and processQueues().

◆ tryCancelCurrentStrokeAsync()

bool KisUpdateScheduler::tryCancelCurrentStrokeAsync ( )

tryCancelCurrentStrokeAsync() checks whether there is a running stroke (which is being executed at this very moment) which is not still open by the owner (endStroke() or cancelStroke() have already been called) and cancels it.

Returns
true if some stroke has been found and cancelled
Note
This method is not part of KisStrokesFacade! It is too low level for KisImage. In KisImage it is combined with more high level requestStrokeCancellation().

Definition at line 200 of file kis_update_scheduler.cpp.

201{
202 return m_d->strokesQueue.tryCancelCurrentStrokeAsync();
203}

References m_d.

◆ tryProcessUpdatesQueue()

void KisUpdateScheduler::tryProcessUpdatesQueue ( )
private

Definition at line 413 of file kis_update_scheduler.cpp.

414{
415 QReadLocker locker(&m_d->updatesStartLock);
416 if(m_d->updatesLockCounter) return;
417
418 m_d->updatesQueue.processQueue(m_d->updaterContext);
419}

References m_d.

◆ tryUndoLastStrokeAsync()

UndoResult KisUpdateScheduler::tryUndoLastStrokeAsync ( )

Definition at line 205 of file kis_update_scheduler.cpp.

206{
207 return m_d->strokesQueue.tryUndoLastStrokeAsync();
208}

References m_d.

◆ unblockUpdates()

void KisUpdateScheduler::unblockUpdates ( )

Unblocks updates from execution previously locked by blockUpdates()

See also
blockUpdates()

Definition at line 400 of file kis_update_scheduler.cpp.

401{
402 m_d->updatesLockCounter.deref();
404}

References m_d, and processQueues().

◆ unlock()

void KisUpdateScheduler::unlock ( bool resetLodLevels = true)

Unblocks the process and calls processQueues()

See also
processQueues()

Legacy strokes may have changed the image while we didn't control it. Notify the queue to take it into account.

Definition at line 295 of file kis_update_scheduler.cpp.

296{
297 if (resetLodLevels) {
302 m_d->strokesQueue.notifyUFOChangedImage();
303 }
304
305 m_d->processingBlocked = false;
307}

References m_d, and processQueues().

◆ updateProjection() [1/2]

void KisUpdateScheduler::updateProjection ( KisNodeSP node,
const QRect & rc,
const QRect & cropRect )

Definition at line 153 of file kis_update_scheduler.cpp.

154{
155 updateProjection(node, {rc}, cropRect, KisProjectionUpdateFlag::None);
156}
void updateProjection(KisNodeSP node, const QVector< QRect > &rects, const QRect &cropRect, KisProjectionUpdateFlags flags)

References None, and updateProjection().

◆ updateProjection() [2/2]

void KisUpdateScheduler::updateProjection ( KisNodeSP node,
const QVector< QRect > & rects,
const QRect & cropRect,
KisProjectionUpdateFlags flags )

Definition at line 141 of file kis_update_scheduler.cpp.

142{
143 m_d->updatesQueue.addUpdateJob(node, rects, cropRect, currentLevelOfDetail(), flags);
145}

References currentLevelOfDetail(), m_d, and processQueues().

◆ updateSettings

void KisUpdateScheduler::updateSettings ( )
protectedslot

Called when it is necessary to reread configuration

Definition at line 281 of file kis_update_scheduler.cpp.

282{
283 m_d->updatesQueue.updateSettings();
284 KisImageConfig config(true);
285 m_d->defaultBalancingRatio = config.schedulerBalancingRatio();
286 setThreadsLimit(config.maxNumberOfThreads());
287}
void setThreadsLimit(int value)

References m_d, KisImageConfig::maxNumberOfThreads(), KisImageConfig::schedulerBalancingRatio(), and setThreadsLimit().

◆ waitForDone()

void KisUpdateScheduler::waitForDone ( )

Waits until all the running jobs are finished.

If some other thread adds jobs in parallel, then you may wait forever. If you don't want it, consider lock() instead.

See also
lock()

Definition at line 321 of file kis_update_scheduler.cpp.

322{
323 do {
325 m_d->updaterContext.waitForDone();
326 } while(!m_d->updatesQueue.isEmpty() || !m_d->strokesQueue.isEmpty());
327}

References m_d, and processQueues().

◆ wakeUpWaitingThreads()

void KisUpdateScheduler::wakeUpWaitingThreads ( )
private

Definition at line 406 of file kis_update_scheduler.cpp.

407{
408 if(m_d->updatesLockCounter && !haveUpdatesRunning()) {
409 m_d->updatesFinishedCondition.wakeAll();
410 }
411}

References haveUpdatesRunning(), and m_d.

◆ wrapAroundModeSupported()

bool KisUpdateScheduler::wrapAroundModeSupported ( ) const

Definition at line 210 of file kis_update_scheduler.cpp.

211{
212 return m_d->strokesQueue.wrapAroundModeSupported();
213}

References m_d.

Friends And Related Symbol Documentation

◆ UpdatesBlockTester

friend class UpdatesBlockTester
friend

Definition at line 236 of file kis_update_scheduler.h.

Member Data Documentation

◆ defaultBalancingRatio

qreal KisUpdateScheduler::defaultBalancingRatio = 1.0

Definition at line 51 of file kis_update_scheduler.cpp.

◆ m_d

Private* const KisUpdateScheduler::m_d
protected

Definition at line 245 of file kis_update_scheduler.h.

◆ processingBlocked

bool KisUpdateScheduler::processingBlocked = false

Definition at line 50 of file kis_update_scheduler.cpp.

◆ progressUpdater

KisQueuesProgressUpdater* KisUpdateScheduler::progressUpdater = 0

Definition at line 53 of file kis_update_scheduler.cpp.

◆ projectionUpdateListener

KisProjectionUpdateListener* KisUpdateScheduler::projectionUpdateListener

Definition at line 52 of file kis_update_scheduler.cpp.

◆ q

KisUpdateScheduler* KisUpdateScheduler::q

Definition at line 45 of file kis_update_scheduler.cpp.

◆ strokesQueue

KisStrokesQueue KisUpdateScheduler::strokesQueue

Definition at line 48 of file kis_update_scheduler.cpp.

◆ updaterContext

KisUpdaterContext KisUpdateScheduler::updaterContext

Definition at line 49 of file kis_update_scheduler.cpp.

◆ updatesFinishedCondition

KisLazyWaitCondition KisUpdateScheduler::updatesFinishedCondition

Definition at line 57 of file kis_update_scheduler.cpp.

◆ updatesLockCounter

QAtomicInt KisUpdateScheduler::updatesLockCounter

Definition at line 55 of file kis_update_scheduler.cpp.

◆ updatesQueue

KisSimpleUpdateQueue KisUpdateScheduler::updatesQueue

Definition at line 47 of file kis_update_scheduler.cpp.

◆ updatesStartLock

QReadWriteLock KisUpdateScheduler::updatesStartLock

Definition at line 56 of file kis_update_scheduler.cpp.


The documentation for this class was generated from the following files: