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

Diff for /pegasus/src/Pegasus/Common/Thread.cpp between version 1.98.4.1 and 1.100.2.6

version 1.98.4.1, 2007/04/04 11:04:44 version 1.100.2.6, 2008/10/23 18:59:32
Line 57 
Line 57 
  
 extern "C" void *_start_wrapper(void *arg_) extern "C" void *_start_wrapper(void *arg_)
 { {
     StartWrapperArg *arg = (StartWrapperArg *) arg_;      // Clean up dynamic memory now to prevent a leak if the thread is canceled.
       StartWrapperArg arg;
       arg.start = ((StartWrapperArg *) arg_)->start;
       arg.arg = ((StartWrapperArg *) arg_)->arg;
       delete (StartWrapperArg *) arg_;
  
     void *return_value = (*arg->start) (arg->arg);      // establish cancelability of the thread
     delete arg;      pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
       pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
   
       void *return_value = (*arg.start) (arg.arg);
  
     return return_value;     return return_value;
 } }
Line 151 
Line 158 
     arg->start = _start;     arg->start = _start;
     arg->arg = this;     arg->arg = this;
  
     Threads::Type type = _is_detached ? Threads::DETACHED : Threads::JOINABLE;      Threads::Type type =
           _is_detached ? Threads::THREADS_DETACHED : Threads::THREADS_JOINABLE;
     int rc = Threads::create(_handle.thid, type, _start_wrapper, arg);     int rc = Threads::create(_handle.thid, type, _start_wrapper, arg);
  
     // On Linux distributions released prior 2005, the implementation of     // On Linux distributions released prior 2005, the implementation of
Line 208 
Line 216 
     return sig;     return sig;
 } }
  
   /*
   ATTN: remove this!
   */
   #if 1
   static Uint32 _num_threads = 0;
   static Mutex _num_threads_mutex;
   #endif
   
 Thread::Thread( Thread::Thread(
     ThreadReturnType(PEGASUS_THREAD_CDECL* start) (void*),     ThreadReturnType(PEGASUS_THREAD_CDECL* start) (void*),
     void* parameter,     void* parameter,
Line 221 
Line 237 
       _thread_parm(parameter),       _thread_parm(parameter),
       _exit_code(0)       _exit_code(0)
 { {
   /*
   ATTN: remove this!
   */
   #if 1
       Uint32 num_threads;
       _num_threads_mutex.lock();
       _num_threads++;
       num_threads = _num_threads;
       printf("Thread::Thread(): num_threads=%u\n", num_threads);
       _num_threads_mutex.unlock();
   #endif
   
     Threads::clear(_handle.thid);     Threads::clear(_handle.thid);
 } }
  
 Thread::~Thread() Thread::~Thread()
 { {
   /*
   ATTN: remove this!
   */
   #if 1
       Uint32 num_threads;
       _num_threads_mutex.lock();
       _num_threads--;
       num_threads = _num_threads;
       printf("Thread::~Thread(): num_threads=%u\n", num_threads);
       _num_threads_mutex.unlock();
   #endif
   
     try     try
     {     {
         join();         join();
Line 426 
Line 466 
  
 void Thread::exit_self(ThreadReturnType exit_code) void Thread::exit_self(ThreadReturnType exit_code)
 { {
 #ifndef PEGASUS_PLATFORM_AIX_RS_IBMCXX  #if !defined(PEGASUS_PLATFORM_AIX_RS_IBMCXX) \
       && !defined(PEGASUS_PLATFORM_PASE_ISERIES_IBMCXX)
     Threads::exit(exit_code);     Threads::exit(exit_code);
 #else #else
     // execute the cleanup stack and then return     // execute the cleanup stack and then return


Legend:
Removed from v.1.98.4.1  
changed lines
  Added in v.1.100.2.6

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2