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


Loading...
Searching...
No Matches
SearchCancellation.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.
5//
6// Extended by UnionTech Software Technology Co., Ltd. (2024)
7// Added search cancellation support for responsive user interactions
9
10#ifndef SEARCHCANCELLATION_H
11#define SEARCHCANCELLATION_H
12
13#include "LuceneTypes.h"
14#include <atomic>
15
16namespace Lucene {
17
31class LPPAPI SearchCancellation {
32public:
37 static void setFlag(std::atomic<bool>* flag);
38
43 static std::atomic<bool>* getFlag();
44
48 static void clear();
49
57 static bool shouldCancel();
58};
59
82
83}
84
85#endif // SEARCHCANCELLATION_H
RAII guard for automatic cancellation flag management.
Definition SearchCancellation.h:71
SearchCancellationGuard(SearchCancellationGuard &&)=delete
SearchCancellationGuard(std::atomic< bool > *flag)
SearchCancellationGuard(const SearchCancellationGuard &)=delete
SearchCancellationGuard & operator=(SearchCancellationGuard &&)=delete
SearchCancellationGuard & operator=(const SearchCancellationGuard &)=delete
Global search cancellation context using thread-local storage.
Definition SearchCancellation.h:31
static std::atomic< bool > * getFlag()
Get current thread's cancellation flag.
static void clear()
Clear current thread's cancellation flag.
static bool shouldCancel()
Check if current thread should cancel (convenience method)
static void setFlag(std::atomic< bool > *flag)
Set cancellation flag for current thread.
Definition AbstractAllTermDocs.h:12

clucene.sourceforge.net