(file) Return to Threads.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/Threads.cpp between version 1.18 and 1.22

version 1.18, 2008/12/02 09:00:53 version 1.22, 2012/10/22 11:18:18
Line 101 
Line 101 
  
 //============================================================================== //==============================================================================
 // //
 // _get_stack_multiplier()  
 //  
 //==============================================================================  
   
 static inline int _get_stack_multiplier()  
 {  
 #if defined(PEGASUS_OS_VMS)  
   
     static int _multiplier = 0;  
     static MutexType _multiplier_mutex = PEGASUS_MUTEX_INITIALIZER;  
   
     //  
     // This code uses a, 'hidden' (non-documented), VMS only, logical  
     //  name (environment variable), PEGASUS_VMS_THREAD_STACK_MULTIPLIER,  
     //  to allow in the field adjustment of the thread stack size.  
     //  
     // We only check for the logical name once to not have an  
     //  impact on performance.  
     //  
     // Note:  This code may have problems in a multithreaded environment  
     //  with the setting of doneOnce to true.  
     //  
     // Current code in Cimserver and the clients do some serial thread  
     //  creations first so this is not a problem now.  
     //  
   
     if (_multiplier == 0)  
     {  
         mutex_lock(&_multiplier_mutex);  
   
         if (_multiplier == 0)  
         {  
             const char *env = getenv("PEGASUS_VMS_THREAD_STACK_MULTIPLIER");  
   
             if (env)  
                 _multiplier = atoi(env);  
   
             if (_multiplier == 0)  
                 _multiplier = 2;  
         }  
   
         mutex_unlock(&_multiplier_mutex);  
     }  
   
     return _multiplier;  
 #elif defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC)  
     return 2;  
 #elif defined(PEGASUS_OS_AIX)  
     return 2;  
 #else  
     return 1;  
 #endif  
 }  
   
 //==============================================================================  
 //  
 // PEGASUS_HAVE_PTHREADS // PEGASUS_HAVE_PTHREADS
 // //
 //============================================================================== //==============================================================================
Line 172 
Line 116 
     // Initialize thread attributes:     // Initialize thread attributes:
  
     pthread_attr_t attr;     pthread_attr_t attr;
     pthread_attr_init(&attr);      int rc = pthread_attr_init(&attr);
       if(rc != 0)
       {
           return rc;
       }
  
     // Detached:     // Detached:
  
Line 187 
Line 135 
     }     }
  
     // Stack size:     // Stack size:
       rc = pthread_attr_setstacksize(&attr, PEGASUS_INITIAL_THREADSTACK_SIZE);
     int multiplier = _get_stack_multiplier();  
   
     if (multiplier != 1)  
     {  
         size_t stacksize;  
   
         if (pthread_attr_getstacksize(&attr, &stacksize) == 0)  
         {  
             int rc = pthread_attr_setstacksize(&attr, stacksize * multiplier);  
             PEGASUS_ASSERT(rc == 0);             PEGASUS_ASSERT(rc == 0);
         }  
     }  
  
     // Scheduling policy:     // Scheduling policy:
  
Line 211 
Line 148 
  
     // Create thread:     // Create thread:
  
     int rc = pthread_create(&thread.thread, &attr, start, arg);      rc = pthread_create(&thread.thread, &attr, start, arg);
  
     if (rc != 0)     if (rc != 0)
     {     {
         thread = ThreadType();         thread = ThreadType();
         return rc;  
     }     }
  
     // Destroy attributes now.     // Destroy attributes now.
Line 225 
Line 161 
  
     // Return:     // Return:
  
     return 0;      return rc;
 } }
  
 ThreadType Threads::self() ThreadType Threads::self()


Legend:
Removed from v.1.18  
changed lines
  Added in v.1.22

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2