23 #include "workerthread.h"
31 waitForOperationsToDo(),
38 foreach (BaseException *e, exceptions) {
45 operations.enqueue( ThreadOperationInfo( newOperation, deleteAtEnd ) );
47 if ( operations.size() == 1 ) {
49 waitForOperationsToDo.wakeAll();
55 if ( operation.operation ) {
56 operation.operation->stop();
67 if ( quitRequested ) {
71 if ( operations.size() == 0 ) {
73 waitForOperationsToDo.wait( &mutex );
75 if ( quitRequested ) {
79 operation = operations.dequeue();
82 operation.operation->run();
83 }
catch (BaseException& e) {
84 BaseException* cloned = e.clone();
85 exceptions.append(cloned);
95 if ( operation.deleteAtEnd ) {
96 delete operation.operation;
98 operation.operation = NULL;
100 if ( quitRequested ) {
108 quitRequested =
true;
111 waitForOperationsToDo.wakeAll();
118 bool ret = (operation.operation != NULL);