Lucene++ - a full-featured, c++ search engine
API Documentation
Global search cancellation context using thread-local storage. More...
#include <SearchCancellation.h>
Static Public Member Functions | |
| static void | setFlag (std::atomic< bool > *flag) |
| Set cancellation flag for current thread. | |
| 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) | |
Global search cancellation context using thread-local storage.
This class provides a mechanism to cancel long-running searches from external code. It uses thread-local storage to ensure thread safety and isolation.
Usage:
Thread-safety: Each thread has its own independent cancellation flag.
|
static |
Clear current thread's cancellation flag.
|
static |
Get current thread's cancellation flag.
|
static |
Set cancellation flag for current thread.
| flag | Pointer to atomic boolean cancellation flag |
|
static |
Check if current thread should cancel (convenience method)
This method is called frequently in tight loops (e.g., ExactPhraseScorer::phraseFreq), so it uses memory_order_relaxed for minimal performance impact.