Index: src/ch/ClipboardMonitor.cpp =================================================================== diff -u -r6dc950d4d76107421ff6eb62069b70f20bcc450e -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision 6dc950d4d76107421ff6eb62069b70f20bcc450e) +++ src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -20,7 +20,7 @@ /// @brief Contains the implementation of clipboard monitor package. //****************************************************************************** #include "stdafx.h" -#include "TWorkerThreadController.h" +#include "../libchcore/TWorkerThreadController.h" #include "ClipboardMonitor.h" #include "ch.h" #include "task.h" Index: src/ch/ClipboardMonitor.h =================================================================== diff -u -r92410cc8f6de1e1696774cb25cb37464c4e74cbd -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/ch/ClipboardMonitor.h (.../ClipboardMonitor.h) (revision 92410cc8f6de1e1696774cb25cb37464c4e74cbd) +++ src/ch/ClipboardMonitor.h (.../ClipboardMonitor.h) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -45,7 +45,7 @@ CTaskArray* m_pTasks; // thread control - TWorkerThreadController m_threadWorker; + chcore::TWorkerThreadController m_threadWorker; }; #endif Index: src/ch/TSubTaskContext.cpp =================================================================== diff -u -r4c09a2d7ab35a30114ff2b7c4db12bc413bf538c -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/ch/TSubTaskContext.cpp (.../TSubTaskContext.cpp) (revision 4c09a2d7ab35a30114ff2b7c4db12bc413bf538c) +++ src/ch/TSubTaskContext.cpp (.../TSubTaskContext.cpp) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -25,7 +25,7 @@ TSubTaskContext::TSubTaskContext(chcore::TTaskDefinition& rTaskDefinition, TBasePathDataContainer& rBasePathDataContainer, CFileInfoArray& rFilesCache, TTaskLocalStats& rTaskLocalStats, TTaskBasicProgressInfo& rTaskBasicProgressInfo, TTaskConfigTracker& rCfgTracker, icpf::log_file& rLog, chcore::IFeedbackHandler* piFeedbackHandler, - TWorkerThreadController& rThreadController, TLocalFilesystem& rfsLocal) : + chcore::TWorkerThreadController& rThreadController, TLocalFilesystem& rfsLocal) : m_rTaskDefinition(rTaskDefinition), m_rBasePathDataContainer(rBasePathDataContainer), m_rFilesCache(rFilesCache), Index: src/ch/TSubTaskContext.h =================================================================== diff -u -r4c09a2d7ab35a30114ff2b7c4db12bc413bf538c -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/ch/TSubTaskContext.h (.../TSubTaskContext.h) (revision 4c09a2d7ab35a30114ff2b7c4db12bc413bf538c) +++ src/ch/TSubTaskContext.h (.../TSubTaskContext.h) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -29,9 +29,9 @@ { class IFeedbackHandler; class TTaskDefinition; + class TWorkerThreadController; } -class TWorkerThreadController; class TBasePathDataContainer; class TTaskLocalStats; class TTaskConfigTracker; @@ -46,7 +46,7 @@ public: TSubTaskContext(chcore::TTaskDefinition& rTaskDefinition, TBasePathDataContainer& rBasePathDataContainer, CFileInfoArray& rFilesCache, TTaskLocalStats& rTaskLocalStats, TTaskBasicProgressInfo& rTaskBasicProgressInfo, TTaskConfigTracker& rCfgTracker, icpf::log_file& rLog, - chcore::IFeedbackHandler* piFeedbackHandler, TWorkerThreadController& rThreadController, TLocalFilesystem& rfsLocal); + chcore::IFeedbackHandler* piFeedbackHandler, chcore::TWorkerThreadController& rThreadController, TLocalFilesystem& rfsLocal); ~TSubTaskContext(); chcore::TTaskDefinition& GetTaskDefinition() { return m_rTaskDefinition; } @@ -73,8 +73,8 @@ chcore::IFeedbackHandler* GetFeedbackHandler() { return m_piFeedbackHandler; } const chcore::IFeedbackHandler* GetFeedbackHandler() const { return m_piFeedbackHandler; } - TWorkerThreadController& GetThreadController() { return m_rThreadController; } - const TWorkerThreadController& GetThreadController() const { return m_rThreadController; } + chcore::TWorkerThreadController& GetThreadController() { return m_rThreadController; } + const chcore::TWorkerThreadController& GetThreadController() const { return m_rThreadController; } TLocalFilesystem& GetLocalFilesystem() { return m_rfsLocal; } const TLocalFilesystem& GetLocalFilesystem() const { return m_rfsLocal; } @@ -105,7 +105,7 @@ chcore::IFeedbackHandler* m_piFeedbackHandler; // thread control - TWorkerThreadController& m_rThreadController; + chcore::TWorkerThreadController& m_rThreadController; }; #endif // __TSUBTASKCONTEXT_H__ \ No newline at end of file Index: src/ch/TSubTaskCopyMove.cpp =================================================================== diff -u -r9a171c5d46f2bc029d99a698d88eeff60497cd3b -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/ch/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 9a171c5d46f2bc029d99a698d88eeff60497cd3b) +++ src/ch/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -54,7 +54,7 @@ chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); TTaskConfigTracker& rCfgTracker = GetContext().GetCfgTracker(); TTaskBasicProgressInfo& rBasicProgressInfo = GetContext().GetTaskBasicProgressInfo(); - TWorkerThreadController& rThreadController = GetContext().GetThreadController(); + chcore::TWorkerThreadController& rThreadController = GetContext().GetThreadController(); chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); TTaskLocalStats& rLocalStats = GetContext().GetTaskLocalStats(); @@ -304,7 +304,7 @@ { chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); TTaskBasicProgressInfo& rBasicProgressInfo = GetContext().GetTaskBasicProgressInfo(); - TWorkerThreadController& rThreadController = GetContext().GetThreadController(); + chcore::TWorkerThreadController& rThreadController = GetContext().GetThreadController(); TTaskLocalStats& rLocalStats = GetContext().GetTaskLocalStats(); icpf::log_file& rLog = GetContext().GetLog(); TTaskConfigTracker& rCfgTracker = GetContext().GetCfgTracker(); Index: src/ch/TSubTaskDelete.cpp =================================================================== diff -u -r6dc950d4d76107421ff6eb62069b70f20bcc450e -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/ch/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision 6dc950d4d76107421ff6eb62069b70f20bcc450e) +++ src/ch/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -24,7 +24,7 @@ #include "TSubTaskDelete.h" #include "TSubTaskContext.h" #include "TBasicProgressInfo.h" -#include "TWorkerThreadController.h" +#include "../libchcore/TWorkerThreadController.h" #include "TTaskConfiguration.h" #include "../libchcore/TTaskDefinition.h" #include "FeedbackHandler.h" @@ -42,7 +42,7 @@ CFileInfoArray& rFilesCache = GetContext().GetFilesCache(); chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); TTaskBasicProgressInfo& rBasicProgressInfo = GetContext().GetTaskBasicProgressInfo(); - TWorkerThreadController& rThreadController = GetContext().GetThreadController(); + chcore::TWorkerThreadController& rThreadController = GetContext().GetThreadController(); chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); // log Index: src/ch/TSubTaskScanDirectory.cpp =================================================================== diff -u -rb0d7cb2020371c35b5fbaab566b4dcc850fed460 -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/ch/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision b0d7cb2020371c35b5fbaab566b4dcc850fed460) +++ src/ch/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -29,7 +29,7 @@ #include "TLocalFilesystem.h" #include "..\libchcore\FeedbackHandlerBase.h" #include "TBasePathData.h" -#include "TWorkerThreadController.h" +#include "../libchcore/TWorkerThreadController.h" #include "TTaskLocalStats.h" TSubTaskScanDirectories::TSubTaskScanDirectories(TSubTaskContext& rContext) : @@ -49,7 +49,7 @@ chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); const TBasePathDataContainer& rarrSourcePathsInfo = GetContext().GetBasePathDataContainer(); - TWorkerThreadController& rThreadController = GetContext().GetThreadController(); + chcore::TWorkerThreadController& rThreadController = GetContext().GetThreadController(); rLog.logi(_T("Searching for files...")); @@ -217,7 +217,7 @@ { CFileInfoArray& rFilesCache = GetContext().GetFilesCache(); chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); - TWorkerThreadController& rThreadController = GetContext().GetThreadController(); + chcore::TWorkerThreadController& rThreadController = GetContext().GetThreadController(); TLocalFilesystemFind finder = TLocalFilesystem::CreateFinderObject(pathDirName, chcore::PathFromString(_T("*"))); CFileInfoPtr spFileInfo(boost::make_shared()); Index: src/ch/ch.vc90.vcproj =================================================================== diff -u -r4c09a2d7ab35a30114ff2b7c4db12bc413bf538c -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/ch/ch.vc90.vcproj (.../ch.vc90.vcproj) (revision 4c09a2d7ab35a30114ff2b7c4db12bc413bf538c) +++ src/ch/ch.vc90.vcproj (.../ch.vc90.vcproj) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -510,14 +510,6 @@ RelativePath=".\TTaskConfiguration.h" > - - - - Index: src/ch/task.h =================================================================== diff -u -r4c09a2d7ab35a30114ff2b7c4db12bc413bf538c -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/ch/task.h (.../task.h) (revision 4c09a2d7ab35a30114ff2b7c4db12bc413bf538c) +++ src/ch/task.h (.../task.h) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -20,7 +20,7 @@ #define __TASK_H__ #include "TAutoHandles.h" -#include "TWorkerThreadController.h" +#include "../libchcore/TWorkerThreadController.h" #include "FileInfo.h" #include "DataBuffer.h" #include "../libchcore/FeedbackHandlerBase.h" @@ -250,7 +250,7 @@ TLocalFilesystem m_fsLocal; /// Thread controlling object - TWorkerThreadController m_workerThread; + chcore::TWorkerThreadController m_workerThread; /// Mutex for locking concurrent access to members of this class mutable boost::shared_mutex m_lock; Index: src/libchcore/ErrorCodes.h =================================================================== diff -u -r5fd6beaad9f1eccb664b997d151acb59961e4827 -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/libchcore/ErrorCodes.h (.../ErrorCodes.h) (revision 5fd6beaad9f1eccb664b997d151acb59961e4827) +++ src/libchcore/ErrorCodes.h (.../ErrorCodes.h) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -41,6 +41,15 @@ // threading (1000+) eErr_MutexTimedOut = 1000, + eErr_CannotCreateEvent = 1001, + eErr_ThreadAlreadyStarted = 1002, + eErr_CannotResetEvent = 1003, + eErr_CannotCreateThread = 1004, + eErr_CannotChangeThreadPriority = 1005, + eErr_CannotResumeThread = 1006, + eErr_WaitingFailed = 1007, + eErr_CannotSuspendThread = 1008, + eErr_CannotSetEvent = 1009, // string errors (1500+) Index: src/libchcore/TCoreException.cpp =================================================================== diff -u -r5fd6beaad9f1eccb664b997d151acb59961e4827 -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/libchcore/TCoreException.cpp (.../TCoreException.cpp) (revision 5fd6beaad9f1eccb664b997d151acb59961e4827) +++ src/libchcore/TCoreException.cpp (.../TCoreException.cpp) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -60,10 +60,49 @@ { } +// ============================================================================ +/// chcore::TCoreException::GetErrorInfo +/// @date 2011/07/18 +/// +/// @brief Retrieves formatted exception information. +/// @param[in] pszBuffer - buffer for formatted string +/// @param[in] stMaxBuffer - max size of buffer +// ============================================================================ void TCoreException::GetErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const { _snwprintf_s(pszBuffer, stMaxBuffer, _TRUNCATE, _T("Error code: %ld\r\nFile: %s\r\nFunction: %s\r\nLine no: %lu"), m_eErrorCode, m_pszFile, m_pszFunction, m_stLineNumber); pszBuffer[stMaxBuffer - 1] = _T('\0'); } +// ============================================================================ +/// chcore::TCoreWin32Exception::TCoreWin32Exception +/// @date 2011/07/18 +/// +/// @brief Constructs core win32 exception. +/// @param[in] eErrorCode - core error code +/// @param[in] dwWin32Exception - win32 error code +/// @param[in] pszFile -source file where the exception was thrown +/// @param[in] stLineNumber - source code line number where the exception was thrown +/// @param[in] pszFunction - function throwing the exception +// ============================================================================ +TCoreWin32Exception::TCoreWin32Exception(EGeneralErrors eErrorCode, DWORD dwWin32Exception, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction) : + TCoreException(eErrorCode, pszFile, stLineNumber, pszFunction), + m_dwWin32ErrorCode(dwWin32Exception) +{ +} + +// ============================================================================ +/// chcore::TCoreWin32Exception::GetErrorInfo +/// @date 2011/07/18 +/// +/// @brief Retrieves formatted exception information. +/// @param[in] pszBuffer - buffer for formatted string +/// @param[in] stMaxBuffer - max size of buffer +// ============================================================================ +void TCoreWin32Exception::GetErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const +{ + _snwprintf_s(pszBuffer, stMaxBuffer, _TRUNCATE, _T("Error code: %ld\r\nWin32 error code: %lu\r\nFile: %s\r\nFunction: %s\r\nLine no: %lu"), m_eErrorCode, m_dwWin32ErrorCode, m_pszFile, m_pszFunction, m_stLineNumber); + pszBuffer[stMaxBuffer - 1] = _T('\0'); +} + END_CHCORE_NAMESPACE Index: src/libchcore/TCoreException.h =================================================================== diff -u -r5fd6beaad9f1eccb664b997d151acb59961e4827 -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/libchcore/TCoreException.h (.../TCoreException.h) (revision 5fd6beaad9f1eccb664b997d151acb59961e4827) +++ src/libchcore/TCoreException.h (.../TCoreException.h) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -27,9 +27,13 @@ // throws core exception object #define THROW_CORE_EXCEPTION(error_code)\ throw TCoreException(error_code, __FILEW__, __LINE__, __FUNCTIONW__) + #define THROW_CORE_EXCEPTION_STD(error_code, std_exception)\ throw TCoreException(error_code, std_exception, __FILEW__, __LINE__, __FUNCTIONW__) +#define THROW_CORE_EXCEPTION_WIN32(error_code, win32_error_code)\ + throw TCoreWin32Exception(error_code, win32_error_code, __FILEW__, __LINE__, __FUNCTIONW__) + class LIBCHCORE_API TCoreException : public virtual std::exception { public: @@ -47,7 +51,7 @@ void GetErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const; private: - TCoreException() {} + TCoreException(); protected: // what happened? @@ -59,6 +63,29 @@ size_t m_stLineNumber; }; +class LIBCHCORE_API TCoreWin32Exception : public TCoreException +{ +public: + TCoreWin32Exception(EGeneralErrors eErrorCode, DWORD dwWin32Exception, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction); + + DWORD GetWin32ErrorCode() const { return m_dwWin32ErrorCode; } + + void GetErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const; + +private: + TCoreWin32Exception(); + +protected: + // what happened? + EGeneralErrors m_eErrorCode; + DWORD m_dwWin32ErrorCode; + + // where it happened? + const wchar_t* m_pszFile; + const wchar_t* m_pszFunction; + size_t m_stLineNumber; +}; + END_CHCORE_NAMESPACE #endif Fisheye: tag b0d7cb2020371c35b5fbaab566b4dcc850fed460 is not in file src/libchcore/TWorkerThreadController.cpp Fisheye: Tag ab32897e61cc637a1e28d9dc3f0489b8d16a429c refers to a dead (removed) revision in file `src/ch/TWorkerThreadController.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 44c811ed2e152c83d92aa7d0b41497a90a177209 is not in file src/libchcore/TWorkerThreadController.h Fisheye: Tag ab32897e61cc637a1e28d9dc3f0489b8d16a429c refers to a dead (removed) revision in file `src/ch/TWorkerThreadController.h'. Fisheye: No comparison available. Pass `N' to diff? Index: src/libchcore/libchcore.vc90.vcproj =================================================================== diff -u -r888524d8a33af49ee8e8ce83f98017323046f109 -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision 888524d8a33af49ee8e8ce83f98017323046f109) +++ src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -531,6 +531,14 @@ RelativePath=".\TTaskOperationPlan.h" > + + + +