| 320 | } |
| 321 | |
| 322 | bool |
| 323 | GenericSchedulerThread::abortThreadedTask(bool keepOldestRender) |
| 324 | { |
| 325 | if ( !isRunning() ) { |
| 326 | return false; |
| 327 | } |
| 328 | |
| 329 | ThreadStateEnum state = getThreadState(); |
| 330 | bool shouldRequestAbort = state != eThreadStateAborted && state != eThreadStateIdle; |
| 331 | if ( keepOldestRender && !shouldRequestAbort ) { |
| 332 | return false; |
| 333 | } |
| 334 | |
| 335 | { |
| 336 | QMutexLocker l(&_imp->abortRequestedMutex); |
| 337 | |
| 338 | |
| 339 | // We are already aborting |
| 340 | if (_imp->abortRequested > 0 && keepOldestRender) { |
| 341 | return false; |
| 342 | } |
| 343 | |
| 344 | #ifdef TRACE_GENERIC_SCHEDULER_THREAD |
| 345 | qDebug() << QThread::currentThread() << ": Aborting task on" << getThreadName().c_str(); |
| 346 | #endif |
| 347 | if (shouldRequestAbort) { |
| 348 | ++_imp->abortRequested; |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | onAbortRequested(keepOldestRender); |
| 353 | |
| 354 | return true; |
| 355 | } |
| 356 | |
| 357 | bool |
| 358 | GenericSchedulerThread::isBeingAborted() const |
no outgoing calls
no test coverage detected