📄 threadingexceptions.h
字号:
#ifndef __GradSoft_ThreadingExceptions_h#define __GradSoft_ThreadingExceptions_h/* * GradSoft C++ ToolBox : Threading * (C) GradSoft, 2001 * Ukraine, Kiev * http://www.gradsoft.com.ua * $Id: ThreadingExceptions.h,v 1.19 2002/03/27 20:02:30 rssh Exp $ */#ifndef __GradSoft_ThreadingPostConfig_h#include <GradSoft/ThreadingPostConfig.h>#endif#ifndef __STDEXCEPT_#include <stdexcept>#ifndef __STDEXCEPT_#define __STDEXCEPT_#endif#endif#ifdef WIN32#pragma warning( disable : 4290 ) #endifnamespace GradSoft {/** * 'namespace' for Threading Exceptions definitions. **/class ThreadingExceptions{public: /** * Base class for Threading Exceptions **/ class Failure : public std::runtime_error { protected: friend class ThreadingError;#ifdef WIN32 friend class StrExTranslator;#endif void setData(int errCode,const char* errMessage); //public: int errorCode_; mutable std::string errorMessage_; mutable bool codeIsAddedToMessage_; public: /// Failure(); /// Failure(int code, const char* message); /// Failure(int code, const std::string& message); /// Failure(const Failure&); /// ~Failure(); /// Failure& operator=(const Failure& x); /** * return OS-depended error code **/ int getErrorCode() const { return errorCode_; } /** * return error message **/ const char* getErrorMessage() const { return what(); } /** * return error message **/ const char* what() const; }; /** * base class for exceptions, which caused by resource limits. **/ class NoResources: public Failure {}; /** * NoMemory. * (in general - same, as std::bad_alloc) **/ class NoMemory : public NoResources {}; /** * resource temporary not aviable **/ class TemporaryNoResources: public NoResources {}; /** * current program have no permission to perform some actions **/ class NoPermission : public NoResources {}; /** * operation can cause a deadlock * (note, that actually deadlock exception on some platforms * or with some compilation options can be not throwed) **/ class PossibleDeadlock : public Failure {}; /** * operation want get access to resource, which is busy now. **/ class ResourceBusy : public Failure {}; /** * InvalidResource **/ class InvalidResource: public Failure {}; /** * system error occured **/ class SystemError : public Failure {}; /** * indicate internal error or incorrect configuration of package **/ class InternalError : public Failure { public: /// InternalError() :Failure(-1,"Threading:InternalError") {} /// InternalError(int code, const char* message) :Failure(code,message) {} }; /** * functionality is not implemented on this platform **/ class NotImplemented : public Failure { public: NotImplemented() :Failure(-1,"Threading:not implemented") {} };};}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -