45 #ifndef QT_NO_EXCEPTIONS 158 : exception(exception), refCount(1), hasThrown(
false) { }
159 ~Base() {
delete exception; }
166 ExceptionHolder::ExceptionHolder(
Exception *exception)
167 :
base(
new Base(exception)) {}
169 ExceptionHolder::ExceptionHolder(
const ExceptionHolder &other)
172 base->refCount.ref();
175 void ExceptionHolder::operator=(
const ExceptionHolder &other)
177 if (
base == other.base)
180 if (
base->refCount.deref() ==
false)
184 base->refCount.ref();
187 ExceptionHolder::~ExceptionHolder()
189 if (
base->refCount.deref() == 0)
193 Exception *ExceptionHolder::exception()
const 195 return base->exception;
198 void ExceptionStore::setException(
const Exception &e)
200 if (hasException() ==
false)
201 exceptionHolder = ExceptionHolder(e.
clone());
204 bool ExceptionStore::hasException()
const 206 return (exceptionHolder.exception() != 0);
209 ExceptionHolder ExceptionStore::exception()
211 return exceptionHolder;
214 void ExceptionStore::throwPossibleException()
216 if (hasException() ) {
217 exceptionHolder.base->hasThrown =
true;
218 exceptionHolder.exception()->raise();
222 bool ExceptionStore::hasThrown()
const {
return exceptionHolder.base->hasThrown; }
232 #endif // QT_NO_EXCEPTIONS 233 #endif // QT_NO_CONCURRENT #define QT_END_NAMESPACE
This macro expands to.
The QAtomicInt class provides platform-independent atomic operations on integers. ...
The UnhandledException class represents an unhandled exception in a worker thread.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Exception * clone() const
The Exception class provides a base class for exceptions that can transferred across threads...
The QtConcurrent namespace provides high-level APIs that make it possible to write multi-threaded pro...
virtual void raise() const
In your QtConcurrent::Exception subclass, reimplement raise() like this:
virtual Exception * clone() const
In your QtConcurrent::Exception subclass, reimplement clone() like this: