(file) Return to CMPI_ThreadContext.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2 / CMPI

Diff for /pegasus/src/Pegasus/ProviderManager2/CMPI/CMPI_ThreadContext.cpp between version 1.21 and 1.21.4.2

version 1.21, 2008/12/16 18:56:55 version 1.21.4.2, 2009/11/18 14:00:35
Line 30 
Line 30 
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include "CMPI_Version.h" #include "CMPI_Version.h"
   #include "CMPI_ThreadContext.h"
 #include "CMPI_Object.h"  
  
 #if !defined(PEGASUS_OS_TYPE_WINDOWS) #if !defined(PEGASUS_OS_TYPE_WINDOWS)
 # include <pthread.h> # include <pthread.h>
Line 43 
Line 42 
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 TSDKeyType CMPI_ThreadContext::contextKey; TSDKeyType CMPI_ThreadContext::contextKey;
 int CMPI_ThreadContext::context_key_once=1;  Once CMPI_ThreadContext::contextKeyOnce = PEGASUS_ONCE_INITIALIZER;
   
 void CMPI_ThreadContext::context_key_alloc()  
 {  
     TSDKey::create(&contextKey);  
 }  
   
 TSDKeyType CMPI_ThreadContext::getContextKey()  
 {  
     if( context_key_once )  
     {  
         context_key_alloc();  
         context_key_once=0;  
     }  
     return contextKey;  
 }  
   
 void CMPI_ThreadContext::add(CMPI_Object *o)  
 {  
     ENQ_TOP_LIST(o,CIMfirst,CIMlast,next,prev);  
 }  
   
 void CMPI_ThreadContext::addObject(CMPI_Object* o)  
 {  
     CMPI_ThreadContext* ctx=getThreadContext();  
     if (ctx)  
     {  
         ctx->add(o);  
     }  
 }  
   
 void CMPI_ThreadContext::remove(CMPI_Object *o)  
 {  
     if( o->next!=reinterpret_cast<CMPI_Object*>((void*)-1l))  
     {  
         DEQ_FROM_LIST(o,CIMfirst,CIMlast,next,prev);  
         o->next=reinterpret_cast<CMPI_Object*>((void*)-1l);  
     }  
 }  
   
 void CMPI_ThreadContext::remObject(CMPI_Object* o)  
 {  
     CMPI_ThreadContext* ctx=getThreadContext();  
     if (ctx)  
     {  
         ctx->remove(o);  
     }  
 }  
   
 CMPI_ThreadContext* CMPI_ThreadContext::getThreadContext()  
 {  
     TSDKeyType k=getContextKey();  
     return(CMPI_ThreadContext*)TSDKey::get_thread_specific(k);  
 }  
   
 const CMPIBroker* CMPI_ThreadContext::getBroker()  
 {  
     /**  
       return getThreadContext()->broker;  
    */  
     CMPI_ThreadContext *ctx = getThreadContext();  
     if( ctx )  
     {  
         return ctx->broker;  
     }  
     return 0;  
 }  
   
 const CMPIContext* CMPI_ThreadContext::getContext()  
 {  
     return getThreadContext()->context;  
 }  
  
 CMPI_ThreadContext::CMPI_ThreadContext( CMPI_ThreadContext::CMPI_ThreadContext(
 const CMPIBroker *mb, const CMPIBroker *mb,
Line 142 
Line 70 
     TSDKey::set_thread_specific(k,prev);     TSDKey::set_thread_specific(k,prev);
 } }
  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  


Legend:
Removed from v.1.21  
changed lines
  Added in v.1.21.4.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2