activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1420476 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent: Threading.cpp ThreadingTypes.h
Date Tue, 11 Dec 2012 22:41:49 GMT
Author: tabish
Date: Tue Dec 11 22:41:48 2012
New Revision: 1420476

URL: http://svn.apache.org/viewvc?rev=1420476&view=rev
Log:
Allow for more TLS keys per thread

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/ThreadingTypes.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp?rev=1420476&r1=1420475&r2=1420476&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
Tue Dec 11 22:41:48 2012
@@ -147,7 +147,6 @@ namespace {
         MonitorPool* monitors;
     };
 
-    #define MAX_TLS_SLOTS 128
     #define MONITOR_POOL_BLOCK_SIZE 64
 
     ThreadingLibrary* library = NULL;
@@ -450,7 +449,7 @@ namespace {
 
     void threadExitTlsCleanup(ThreadHandle* thread) {
 
-        for (int index = 0; index < MAX_TLS_SLOTS; ++index) {
+        for (int index = 0; index < DECAF_MAX_TLS_SLOTS; ++index) {
             if (thread->tls[index] != NULL) {
                 ThreadLocalImpl* handler = NULL;
                 void *value = NULL;
@@ -820,7 +819,7 @@ void Threading::initialize() {
     library->monitors->head = batchAllocateMonitors();
     library->monitors->count = MONITOR_POOL_BLOCK_SIZE;
 
-    library->tlsSlots.resize(MAX_TLS_SLOTS);
+    library->tlsSlots.resize(DECAF_MAX_TLS_SLOTS);
 
     // We mark the thread where Decaf's Init routine is called from as our Main Thread.
     library->mainThread = PlatformThread::getCurrentThread();
@@ -1549,7 +1548,7 @@ int Threading::createThreadLocalSlot(Thr
 
     PlatformThread::lockMutex(library->tlsLock);
 
-    for (index = 0; index < MAX_TLS_SLOTS; index++) {
+    for (index = 0; index < DECAF_MAX_TLS_SLOTS; index++) {
         if (library->tlsSlots[index] == NULL) {
             library->tlsSlots[index] = threadLocal;
             break;
@@ -1558,7 +1557,7 @@ int Threading::createThreadLocalSlot(Thr
 
     PlatformThread::unlockMutex(library->tlsLock);
 
-    return index < MAX_TLS_SLOTS ? index : -1;
+    return index < DECAF_MAX_TLS_SLOTS ? index : -1;
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/ThreadingTypes.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/ThreadingTypes.h?rev=1420476&r1=1420475&r2=1420476&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/ThreadingTypes.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/ThreadingTypes.h
Tue Dec 11 22:41:48 2012
@@ -36,6 +36,11 @@ namespace util{
 namespace concurrent{
 
     /**
+     * Max number of TLS keys that a thread can use.
+     */
+    #define DECAF_MAX_TLS_SLOTS 256
+
+    /**
      * This is the main method for thread instances, this value is valid
      * on any platform, the PlatformThread methods will handle calling this
      * method and providing it with its assigned arg.
@@ -75,7 +80,7 @@ namespace concurrent{
         bool suspended;
         char* name;
         long long stackSize;
-        void *tls[128];
+        void *tls[DECAF_MAX_TLS_SLOTS];
         threadingTask threadMain;
         void* threadArg;
         long long threadId;



Mime
View raw message