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

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes
Lucene::LuceneThread Class Referenceabstract

Lucene thread container. More...

`#include <LuceneThread.h>`

Inheritance diagram for Lucene::LuceneThread:

## Public Member Functions

| LuceneThread ()
virtual | ~LuceneThread ()
virtual String | getClassName ()
boost::shared_ptr< LuceneThread > | shared_from_this ()
virtual void | start ()
| start thread see `run`.
virtual bool | isAlive ()
| return whether thread is current running.
virtual void | setPriority (int32_t priority)
| set running thread priority.
virtual int32_t | getPriority ()
| return running thread priority.
virtual bool | join (int32_t timeout=0)
| wait for thread to finish using an optional timeout.
virtual void | yield ()
| causes the currently executing thread object to temporarily pause and allow other threads to execute.
virtual void | run ()=0
| override to provide the body of the thread.
Public Member Functions inherited from Lucene::LuceneObject
virtual | ~LuceneObject ()
virtual void | initialize ()
| Called directly after instantiation to create objects that depend on this object being fully constructed.
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr())
| Return clone of this object.
virtual int32_t | hashCode ()
| Return hash code for this object.
virtual bool | equals (const LuceneObjectPtr &other)
| Return whether two objects are equal.
virtual int32_t | compareTo (const LuceneObjectPtr &other)
| Compare two objects.
virtual String | toString ()
| Returns a string representation of the object.
Public Member Functions inherited from Lucene::LuceneSync
virtual | ~LuceneSync ()
virtual SynchronizePtr | getSync ()
| Return this object synchronize lock.
virtual LuceneSignalPtr | getSignal ()
| Return this object signal.
virtual void | lock (int32_t timeout=0)
| Lock this object using an optional timeout.
virtual void | unlock ()
| Unlock this object.
virtual bool | holdsLock ()
| Returns true if this object is currently locked by current thread.
virtual void | wait (int32_t timeout=0)
| Wait for signal using an optional timeout.
virtual void | notifyAll ()
| Notify all threads waiting for signal.

## Static Public Member Functions

static String | _getClassName ()
static int64_t | currentId ()
| Return representation of current execution thread.
static void | threadSleep (int32_t time)
| Suspends current execution thread for a given time.
static void | threadYield ()
| Yield current execution thread.

## Static Public Attributes

static const int32_t | MAX_THREAD_PRIORITY
static const int32_t | NORM_THREAD_PRIORITY
static const int32_t | MIN_THREAD_PRIORITY

## Protected Member Functions

void | setRunning (bool running)
| set thread running state.
bool | isRunning ()
| return thread running state.
Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Static Protected Member Functions

static void | runThread (LuceneThread *thread)
| function that controls the lifetime of the running thread.

## Protected Attributes

threadPtr | thread
bool | running
| Flag to indicate running thread.
Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr | objectLock
LuceneSignalPtr | objectSignal

## Detailed Description

Lucene thread container.

It seems there are major issues with using boost::thread::id under Windows. After many hours of debugging and trying various strategies, I was unable to fix an occasional crash whereby boost::thread::thread_data was being deleted prematurely.

This problem is most visible when running the AtomicUpdateTest test suite.

Therefore, I now uniquely identify threads by their native id.

## Constructor & Destructor Documentation

## ◆ LuceneThread()

Lucene::LuceneThread::LuceneThread | ( |  | ) |

Referenced by _getClassName(), and runThread().

## ◆ ~LuceneThread()

virtual Lucene::LuceneThread::~LuceneThread | ( |  | ) |

virtual

## Member Function Documentation

## ◆ _getClassName()

String Lucene::LuceneThread::_getClassName | ( |  | ) |

inline static

References LuceneThread().

## ◆ currentId()

int64_t Lucene::LuceneThread::currentId | ( |  | ) |

static

Return representation of current execution thread.

Referenced by Lucene::CloseableThreadLocal< TYPE >::close(), Lucene::CloseableThreadLocal< TYPE >::get(), and Lucene::CloseableThreadLocal< TYPE >::set().

## ◆ getClassName()

virtual String Lucene::LuceneThread::getClassName | ( |  | ) |

inline virtual

## ◆ getPriority()

virtual int32_t Lucene::LuceneThread::getPriority | ( |  | ) |

virtual

return running thread priority.

## ◆ isAlive()

virtual bool Lucene::LuceneThread::isAlive | ( |  | ) |

virtual

return whether thread is current running.

## ◆ isRunning()

bool Lucene::LuceneThread::isRunning | ( |  | ) |

protected

return thread running state.

## ◆ join()

virtual bool Lucene::LuceneThread::join | ( | int32_t | timeout = 0 | ) |

virtual

wait for thread to finish using an optional timeout.

## ◆ run()

virtual void Lucene::LuceneThread::run | ( |  | ) |

pure virtual

override to provide the body of the thread.

## ◆ runThread()

void Lucene::LuceneThread::runThread | ( | LuceneThread * | thread | ) |

static protected

function that controls the lifetime of the running thread.

References LuceneThread(), and thread.

## ◆ setPriority()

virtual void Lucene::LuceneThread::setPriority | ( | int32_t | priority | ) |

virtual

set running thread priority.

## ◆ setRunning()

void Lucene::LuceneThread::setRunning | ( | bool | running | ) |

protected

set thread running state.

References running.

## ◆ shared_from_this()

boost::shared_ptr< LuceneThread > Lucene::LuceneThread::shared_from_this | ( |  | ) |

inline

## ◆ start()

virtual void Lucene::LuceneThread::start | ( |  | ) |

virtual

start thread see `run`.

## ◆ threadSleep()

void Lucene::LuceneThread::threadSleep | ( | int32_t | time | ) |

static

Suspends current execution thread for a given time.

## ◆ threadYield()

void Lucene::LuceneThread::threadYield | ( |  | ) |

static

Yield current execution thread.

## ◆ yield()

virtual void Lucene::LuceneThread::yield | ( |  | ) |

virtual

causes the currently executing thread object to temporarily pause and allow other threads to execute.

## Field Documentation

## ◆ MAX_THREAD_PRIORITY

const int32_t Lucene::LuceneThread::MAX_THREAD_PRIORITY

static

## ◆ MIN_THREAD_PRIORITY

const int32_t Lucene::LuceneThread::MIN_THREAD_PRIORITY

static

## ◆ NORM_THREAD_PRIORITY

const int32_t Lucene::LuceneThread::NORM_THREAD_PRIORITY

static

## ◆ running

bool Lucene::LuceneThread::running

protected

Flag to indicate running thread.

See also
  isAlive

Referenced by setRunning().

## ◆ thread

threadPtr Lucene::LuceneThread::thread

protected

Referenced by runThread().

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

- LuceneThread.h

clucene.sourceforge.net