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


Lock.h
Go to the documentation of this file.
1 // 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 LOCK_H
8 #define LOCK_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene {
13 
16 class LPPAPI Lock : public LuceneObject {
17 public:
18  virtual ~Lock();
20 
21 public:
23  static const int32_t LOCK_OBTAIN_WAIT_FOREVER;
24 
26  static const int32_t LOCK_POLL_INTERVAL;
27 
28 public:
31  virtual bool obtain() = 0;
32 
34  virtual void release() = 0;
35 
38  virtual bool isLocked() = 0;
39 
45  bool obtain(int32_t lockWaitTimeout);
46 };
47 
48 }
49 
50 #endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::Lock::obtain
virtual bool obtain()=0
Attempts to obtain exclusive access and immediately return upon success or failure.
Lucene::Lock
An interprocess mutex lock.
Definition: Lock.h:16
Lucene::Lock::obtain
bool obtain(int32_t lockWaitTimeout)
Attempts to obtain an exclusive lock within amount of time given. Polls once per LOCK_POLL_INTERVAL (...
Lucene::Lock::isLocked
virtual bool isLocked()=0
Returns true if the resource is currently locked. Note that one must still call obtain() before using...
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene::Lock::~Lock
virtual ~Lock()
Lucene::Lock::LOCK_OBTAIN_WAIT_FOREVER
static const int32_t LOCK_OBTAIN_WAIT_FOREVER
How long obtain(int64_t) waits, in milliseconds, in between attempts to acquire the lock.
Definition: Lock.h:19
Lucene::Lock::release
virtual void release()=0
Releases exclusive access.
Lucene::Lock::LOCK_POLL_INTERVAL
static const int32_t LOCK_POLL_INTERVAL
Pass this value to obtain(int64_t) to try forever to obtain the lock.
Definition: Lock.h:26
LuceneObject.h

clucene.sourceforge.net