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

Loading...
Searching...
No Matches
LuceneThread.h
Go to the documentation of this file.
1
2// Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3// Distributable under the terms of either the Apache License (Version 2.0)
4// or the GNU Lesser General Public License.
6
7#ifndef LUCENETHREAD_H
8#define LUCENETHREAD_H
9
10#include "LuceneObject.h"
11
12 namespace Lucene {
13
23 class LPPAPI LuceneThread : public LuceneObject {
24 public:
25 LuceneThread();
26 virtual ~LuceneThread();
27
28 LUCENE_CLASS(LuceneThread);
29
30 public:
31 static const int32_t MAX_THREAD_PRIORITY;
32 static const int32_t NORM_THREAD_PRIORITY;
33 static const int32_t MIN_THREAD_PRIORITY;
34
35 protected:
36 threadPtr thread;
37
40 bool running;
41
42 public:
44 virtual void start();
45
47 virtual bool isAlive();
48
50 virtual void setPriority(int32_t priority);
51
53 virtual int32_t getPriority();
54
56 virtual bool join(int32_t timeout = 0);
57
59 virtual void yield();
60
62 virtual void run() = 0;
63
65 static int64_t currentId();
66
68 static void threadSleep(int32_t time);
69
71 static void threadYield();
72
73 protected:
75 void setRunning(bool running);
76
78 bool isRunning();
79
81 static void runThread(LuceneThread* thread);
82};
83
84}
85
86#endif
LuceneObject.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Lucene::LuceneObject
Base class for all Lucene classes.
Definition LuceneObject.h:31
Lucene::LuceneThread
Lucene thread container.
Definition LuceneThread.h:23
Lucene::LuceneThread::currentId
static int64_t currentId()
Return representation of current execution thread.
Lucene::LuceneThread::yield
virtual void yield()
causes the currently executing thread object to temporarily pause and allow other threads to execute.
Lucene::LuceneThread::threadSleep
static void threadSleep(int32_t time)
Suspends current execution thread for a given time.
Lucene::LuceneThread::isRunning
bool isRunning()
return thread running state.
Lucene::LuceneThread::NORM_THREAD_PRIORITY
static const int32_t NORM_THREAD_PRIORITY
Definition LuceneThread.h:32
Lucene::LuceneThread::MIN_THREAD_PRIORITY
static const int32_t MIN_THREAD_PRIORITY
Definition LuceneThread.h:33
Lucene::LuceneThread::join
virtual bool join(int32_t timeout=0)
wait for thread to finish using an optional timeout.
Lucene::LuceneThread::start
virtual void start()
start thread see run.
Lucene::LuceneThread::threadYield
static void threadYield()
Yield current execution thread.
Lucene::LuceneThread::MAX_THREAD_PRIORITY
static const int32_t MAX_THREAD_PRIORITY
Definition LuceneThread.h:31
Lucene::LuceneThread::getPriority
virtual int32_t getPriority()
return running thread priority.
Lucene::LuceneThread::setPriority
virtual void setPriority(int32_t priority)
set running thread priority.
Lucene::LuceneThread::~LuceneThread
virtual ~LuceneThread()
Lucene::LuceneThread::runThread
static void runThread(LuceneThread *thread)
function that controls the lifetime of the running thread.
Lucene::LuceneThread::run
virtual void run()=0
override to provide the body of the thread.
Lucene::LuceneThread::LuceneThread
LuceneThread()
Lucene::LuceneThread::running
bool running
Flag to indicate running thread.
Definition LuceneThread.h:40
Lucene::LuceneThread::isAlive
virtual bool isAlive()
return whether thread is current running.
Lucene::LuceneThread::thread
threadPtr thread
Definition LuceneThread.h:36
Lucene::LuceneThread::setRunning
void setRunning(bool running)
set thread running state.
Lucene
Definition AbstractAllTermDocs.h:12

clucene.sourceforge.net