activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r817644 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp
Date Tue, 22 Sep 2009 13:07:48 GMT
Author: tabish
Date: Tue Sep 22 13:07:47 2009
New Revision: 817644

URL: http://svn.apache.org/viewvc?rev=817644&view=rev
Log:
Fix some compilation errors on Windows

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp?rev=817644&r1=817643&r2=817644&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp Tue Sep 22 13:07:47
2009
@@ -196,10 +196,9 @@
         Thread* currentThread;
 
         unsigned int __stdcall threadWorker( void* arg ) {
-            ThreadHandle* handle = (ThreadHandle*)arg;
-            handle->running = true;
-            handle->entryFunctionPtr( handle, handle->userArg );
-            handle->running = false;
+            ThreadProperties* properties = (ThreadProperties*)arg;
+
+            ThreadProperties::runCallback( properties );
 
             #ifndef _WIN32_WCE
                 _endthreadex( 0 );
@@ -207,7 +206,7 @@
                 ExitThread( 0 );
             #endif
 
-            ::CloseHandle( handle->handle );
+            ::CloseHandle( properties->handle );
 
             return NULL;
         }
@@ -241,13 +240,17 @@
 ////////////////////////////////////////////////////////////////////////////////
 void Thread::shutdownThreading() {
 
-    // Get the Main Thread and Destroy it
-    Thread* mainThread = (Thread*) pthread_getspecific( currentThreadKey );
+    #ifdef HAVE_PTHREAD_H
+
+        // Get the Main Thread and Destroy it
+        Thread* mainThread = (Thread*) pthread_getspecific( currentThreadKey );
 
-    delete mainThread;
+        delete mainThread;
 
-    // Destroy the current Thread key now, no longer needed.
-    pthread_key_delete( currentThreadKey );
+        // Destroy the current Thread key now, no longer needed.
+        pthread_key_delete( currentThreadKey );
+
+    #endif
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -325,14 +328,14 @@
 
             #ifndef _WIN32_WCE
 
-                handle->handle = (HANDLE)_beginthreadex(
+                properties->handle = (HANDLE)_beginthreadex(
                      NULL, (DWORD)0, threadWorker, properties.get(), 0, &threadId );
 
             #else
 
-                handle->hanlde = CreateThread( NULL, 0, threadWorker, handle.get(), 0,
&threadId ) );
+                properties->hanlde = CreateThread( NULL, 0, threadWorker, properties.get(),
0, &threadId ) );
 
-                if( handle->handle == 0 ) {
+                if( properties->handle == 0 ) {
                     throw RuntimeException(
                         __FILE__, __LINE__, "Failed to create new Thread." );
                 }
@@ -459,7 +462,7 @@
         tv.tv_sec = usecs / 1000000;
         select( 0, NULL, NULL, NULL, &tv );
     #else
-        ::Sleep( (DWORD)mills );
+        ::Sleep( (DWORD)millisecs );
     #endif
 }
 



Mime
View raw message