diff options
author | Matthew Newhook <matthew@zeroc.com> | 2006-03-02 09:06:09 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2006-03-02 09:06:09 +0000 |
commit | 8c6dd2a8c163a13683ff40ec2dc81738d3e1e711 (patch) | |
tree | b0e747d07e26e93a946eed5a501c6881896c6415 /cppe/src/IceE/Thread.cpp | |
parent | http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=824 (diff) | |
download | ice-8c6dd2a8c163a13683ff40ec2dc81738d3e1e711.tar.bz2 ice-8c6dd2a8c163a13683ff40ec2dc81738d3e1e711.tar.xz ice-8c6dd2a8c163a13683ff40ec2dc81738d3e1e711.zip |
windows fixes.
Diffstat (limited to 'cppe/src/IceE/Thread.cpp')
-rw-r--r-- | cppe/src/IceE/Thread.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/cppe/src/IceE/Thread.cpp b/cppe/src/IceE/Thread.cpp index 7869ec1583a..af7cf031eda 100644 --- a/cppe/src/IceE/Thread.cpp +++ b/cppe/src/IceE/Thread.cpp @@ -30,7 +30,7 @@ using namespace std; // IceUtil::ThreadControl::ThreadControl() : _id(GetCurrentThreadId()), - _handle(new HandleWrapper(static_cast<HANDLE>(_id), false)) + _handle(new HandleWrapper(reinterpret_cast<HANDLE>(_id), false)) { } #else @@ -61,8 +61,8 @@ IceUtil::ThreadControl::ThreadControl(const HandleWrapperPtr& handle, IceUtil::T } IceUtil::ThreadControl::ThreadControl(const ThreadControl& tc) : - _id(tc.id), - _handle(tc.handle) + _id(tc._id), + _handle(tc._handle) { } @@ -71,8 +71,8 @@ IceUtil::ThreadControl::operator=(const ThreadControl& rhs) { if(&rhs != this) { - _id = rhs.id; - _handle = rhs.handle; + _id = rhs._id; + _handle = rhs._handle; } return *this; } @@ -143,6 +143,11 @@ IceUtil::Thread::~Thread() static void* startHook(void* arg) { + //
+ // Ensure that the thread doesn't go away until run() has
+ // completed.
+ //
+ IceUtil::ThreadPtr thread;
try { IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg); @@ -153,11 +158,7 @@ startHook(void* arg) unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds()); srand(seed); - // - // Ensure that the thread doesn't go away until run() has - // completed. - // - IceUtil::ThreadPtr thread = rawThread; + thread = rawThread; // // See the comment in IceUtil::Thread::start() for details. @@ -201,11 +202,13 @@ IceUtil::Thread::start(size_t stackSize) __incRef(); #ifndef _WIN32_WCE + unsigned int id;
_handle->handle = (HANDLE)_beginthreadex( - 0, stackSize, (unsigned int (__stdcall*)(void*))startHook, (LPVOID)this, 0, &_id); -#else + 0, stackSize, (unsigned int (__stdcall*)(void*))startHook, (LPVOID)this, 0, &id); + _id = id;
+#else
_handle->handle = CreateThread( - 0, stackSize, (unsigned long (__stdcall*)(void*))startHook, (LPVOID)this, 0, &_id); + 0, stackSize, (unsigned long (__stdcall*)(void*))startHook, (LPVOID)this, 0, &_id);
#endif if(_handle->handle == 0) { |