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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LuceneThread.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 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  {
25  public:
26  LuceneThread();
27  virtual ~LuceneThread();
28 
30 
31  public:
32  static const int32_t MAX_PRIORITY;
33  static const int32_t NORM_PRIORITY;
34  static const int32_t MIN_PRIORITY;
35 
36  protected:
37  threadPtr thread;
38 
41  bool running;
42 
43  public:
45  virtual void start();
46 
48  virtual bool isAlive();
49 
51  virtual void setPriority(int32_t priority);
52 
54  virtual int32_t getPriority();
55 
57  virtual bool join(int32_t timeout = 0);
58 
60  virtual void yield();
61 
63  virtual void run() = 0;
64 
66  static int64_t currentId();
67 
69  static void threadSleep(int32_t time);
70 
72  static void threadYield();
73 
74  protected:
76  void setRunning(bool running);
77 
79  bool isRunning();
80 
82  static void runThread(LuceneThread* thread);
83  };
84 }
85 
86 #endif

clucene.sourceforge.net