CLucene - a full-featured, c++ search engine
API Documentation


lucene::util::ThreadLocalBase Class Reference

#include <ThreadLocal.h>

Inheritance diagram for lucene::util::ThreadLocalBase:
lucene::debug::LuceneBase lucene::util::ThreadLocal< T, _deletor >

List of all members.

Public Types

typedef void ShutdownHook (bool startup)
 A hook called when CLucene is starting or shutting down, this can be used for setting up and tearing down static variables.

Public Member Functions

virtual ~ThreadLocalBase ()
virtual void setNull ()=0
 Call this function to clear the local thread data for this ThreadLocal.

Static Public Member Functions

static void UnregisterCurrentThread ()
 If you want to clean up thread specific memory, then you should make sure this thread is called when the thread is not going to be used again.
static void shutdown ()
 Call this function to shutdown CLucene.
static void registerShutdownHook (ShutdownHook *hook)
 Add this function to the shutdown hook list.

Protected Types

typedef
lucene::util::CLMultiMap
< _LUCENE_THREADID_TYPE,
ThreadLocalBase
*, lucene::util::CLuceneThreadIdCompare,
lucene::util::Deletor::ConstNullVal
< _LUCENE_THREADID_TYPE >
, lucene::util::Deletor::ConstNullVal
< ThreadLocalBase * > > 
ThreadLocalsType
typedef
lucene::util::CLSetList
< ShutdownHook
*, lucene::util::Compare::Void
< ShutdownHook >
, lucene::util::Deletor::ConstNullVal
< ShutdownHook * > > 
ShutdownHooksType

Protected Member Functions

 ThreadLocalBase ()

Static Protected Attributes

static ThreadLocalsType threadLocals
static ShutdownHooksType shutdownHooks

Member Typedef Documentation

typedef void lucene::util::ThreadLocalBase::ShutdownHook(bool startup)

A hook called when CLucene is starting or shutting down, this can be used for setting up and tearing down static variables.

typedef lucene:: util ::CLMultiMap<_LUCENE_THREADID_TYPE, ThreadLocalBase*, lucene:: util ::CLuceneThreadIdCompare, lucene:: util ::Deletor::ConstNullVal<_LUCENE_THREADID_TYPE>, lucene:: util ::Deletor::ConstNullVal<ThreadLocalBase*> > lucene::util::ThreadLocalBase::ThreadLocalsType [protected]

Constructor & Destructor Documentation

lucene::util::ThreadLocalBase::ThreadLocalBase (  )  [protected]
virtual lucene::util::ThreadLocalBase::~ThreadLocalBase (  )  [virtual]

Member Function Documentation

static void lucene::util::ThreadLocalBase::registerShutdownHook ( ShutdownHook hook  )  [static]

Add this function to the shutdown hook list.

This function will be called when CLucene is shutdown.

virtual void lucene::util::ThreadLocalBase::setNull (  )  [pure virtual]

Call this function to clear the local thread data for this ThreadLocal.

Calling set(NULL) does the same thing, except this function is virtual and can be called without knowing the template.

Implemented in lucene::util::ThreadLocal< T, _deletor >, lucene::util::ThreadLocal< TermVectorsReader *, lucene::util::Deletor::Object< TermVectorsReader > >, and lucene::util::ThreadLocal< SegmentTermEnum *, lucene::util::Deletor::Object< SegmentTermEnum > >.

static void lucene::util::ThreadLocalBase::shutdown (  )  [static]

Call this function to shutdown CLucene.

static void lucene::util::ThreadLocalBase::UnregisterCurrentThread (  )  [static]

If you want to clean up thread specific memory, then you should make sure this thread is called when the thread is not going to be used again.

This will clean up threadlocal data which can contain quite a lot of data, so if you are creating lots of new threads, then it is a good idea to use this function, otherwise there will be many memory leaks.


Member Data Documentation


The documentation for this class was generated from the following file:

clucene.sourceforge.net