Changeset 99e4d8f in nscp for include/thread.h
- Timestamp:
- 11/24/07 00:30:28 (6 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- 7e33d82
- Parents:
- 58a724d
- File:
-
- 1 edited
-
include/thread.h (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
include/thread.h
rdc65e35 r99e4d8f 26 26 class ThreadException { 27 27 public: 28 std:: string e_;29 ThreadException(std:: string e) : e_(e) {30 std:: cerr << e << std::endl;28 std::wstring e_; 29 ThreadException(std::wstring e) : e_(e) { 30 std::wcerr << e << std::endl; 31 31 } 32 32 }; … … 58 58 class Thread { 59 59 private: 60 std:: string threadid_;60 std::wstring threadid_; 61 61 HANDLE hThread_; // Thread handle 62 62 T* pObject_; // Wrapped object … … 81 81 * Sets up default values 82 82 */ 83 Thread(std:: string threadid) : threadid_(threadid), hThread_(NULL), pObject_(NULL), uThreadID(-1), bThreadHasTerminated(false), bThreadHasBeenClosed(false) {83 Thread(std::wstring threadid) : threadid_(threadid), hThread_(NULL), pObject_(NULL), uThreadID(-1), bThreadHasTerminated(false), bThreadHasBeenClosed(false) { 84 84 hMutex_ = CreateMutex(NULL, FALSE, NULL); 85 85 assert(hMutex_ != NULL); … … 95 95 ; 96 96 else if (bThreadHasBeenClosed||bThreadHasTerminated) 97 std:: cout << "Thread has not terminated correctly: " << threadid_ << "..." << std::endl;97 std::wcout << "Thread has not terminated correctly: " << threadid_ << "..." << std::endl; 98 98 /* 99 99 MutexLock mutex(hMutex_, 5000L); … … 153 153 MutexLock mutex(hMutex_, 5000L); 154 154 if (!mutex.hasMutex()) { 155 throw ThreadException( "Could not retrieve mutex, thread (" + threadid_ + ") not started...");155 throw ThreadException(_T("Could not retrieve mutex, thread (") + threadid_ + _T(") not started...")); 156 156 } 157 157 if (pObject_) { 158 throw ThreadException( "Thread already started, thread (" + threadid_ + ") not started...");158 throw ThreadException(_T("Thread already started, thread (") + threadid_ + _T(") not started...")); 159 159 } 160 160 // assert(hStopEvent_ == NULL); … … 179 179 MutexLock mutex(hMutex_, delay); 180 180 if (!mutex.hasMutex()) { 181 throw ThreadException( "Could not retrieve mutex, thread (" + threadid_ + ") not stopped...");181 throw ThreadException(_T("Could not retrieve mutex, thread (") + threadid_ + _T(") not stopped...")); 182 182 } 183 183 if (!pObject_) … … 193 193 return true; 194 194 } 195 std:: cerr << "Failed to terminate thread: " << threadid_ << "..."<< std::endl;195 std::wcerr << _T("Failed to terminate thread: ") << threadid_ << _T("...") << std::endl; 196 196 assert(false); 197 197 return false; … … 200 200 MutexLock mutex(hMutex_, 5000L); 201 201 if (!mutex.hasMutex()) { 202 throw ThreadException( "Could not retrieve mutex, thread (" + threadid_ + ") not stopped...");202 throw ThreadException(_T("Could not retrieve mutex, thread (") + threadid_ + _T(") not stopped...")); 203 203 } 204 204 if (bThreadHasTerminated||bThreadHasBeenClosed) … … 209 209 MutexLock mutex(hMutex_, 5000L); 210 210 if (!mutex.hasMutex()) { 211 throw ThreadException( "Could not retrieve mutex, thread (" + threadid_ + ") not stopped...");211 throw ThreadException(_T("Could not retrieve mutex, thread (") + threadid_ + _T(") not stopped...")); 212 212 } 213 213 if (bThreadHasTerminated||bThreadHasBeenClosed) … … 218 218 MutexLock mutex(hMutex_, 5000L); 219 219 if (!mutex.hasMutex()) { 220 throw ThreadException( "Could not retrieve mutex, thread (" + threadid_ + ") not stopped...");220 throw ThreadException(_T("Could not retrieve mutex, thread (") + threadid_ + _T(") not stopped...")); 221 221 } 222 222 if (bThreadHasTerminated||bThreadHasBeenClosed)
Note: See TracChangeset
for help on using the changeset viewer.








