Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::StateWithBlockableTasks Class Reference
Inheritance diagram for duckdb::StateWithBlockableTasks:
Collaboration diagram for duckdb::StateWithBlockableTasks:

Public Member Functions

unique_lock< mutex > Lock ()
 
void PreventBlocking (const unique_lock< mutex > &guard)
 
bool BlockTask (const unique_lock< mutex > &guard, const InterruptState &interrupt_state)
 Add a task to 'blocked_tasks' before returning SourceResultType::BLOCKED (must hold the lock)
 
bool CanBlock (const unique_lock< mutex > &guard) const
 
bool UnblockTasks (const unique_lock< mutex > &guard)
 Unblock all tasks (must hold the lock)
 
SinkResultType BlockSink (const unique_lock< mutex > &guard, const InterruptState &interrupt_state)
 
SourceResultType BlockSource (const unique_lock< mutex > &guard, const InterruptState &interrupt_state)
 
void VerifyLock (const unique_lock< mutex > &guard) const
 

Private Attributes

atomic< bool > can_block {true}
 Whether we can block tasks.
 
mutex lock
 Global lock, acquired by calling Lock()
 
vector< InterruptStateblocked_tasks
 Tasks that are currently blocked.
 

Member Function Documentation

◆ Lock()

unique_lock< mutex > duckdb::StateWithBlockableTasks::Lock ( )
inline
21881 {
21882 return unique_lock<mutex>(lock);
21883 }
mutex lock
Global lock, acquired by calling Lock()
Definition duckdb.hpp:21936

◆ PreventBlocking()

void duckdb::StateWithBlockableTasks::PreventBlocking ( const unique_lock< mutex > &  guard)
inline
21885 {
21886 VerifyLock(guard);
21887 can_block = false;
21888 }
atomic< bool > can_block
Whether we can block tasks.
Definition duckdb.hpp:21934

◆ BlockTask()

bool duckdb::StateWithBlockableTasks::BlockTask ( const unique_lock< mutex > &  guard,
const InterruptState interrupt_state 
)
inline

Add a task to 'blocked_tasks' before returning SourceResultType::BLOCKED (must hold the lock)

21891 {
21892 VerifyLock(guard);
21893 if (can_block) {
21894 blocked_tasks.push_back(interrupt_state);
21895 return true;
21896 }
21897 return false;
21898 }
vector< InterruptState > blocked_tasks
Tasks that are currently blocked.
Definition duckdb.hpp:21938

◆ CanBlock()

bool duckdb::StateWithBlockableTasks::CanBlock ( const unique_lock< mutex > &  guard) const
inline
21900 {
21901 VerifyLock(guard);
21902 return can_block;
21903 }

◆ UnblockTasks()

bool duckdb::StateWithBlockableTasks::UnblockTasks ( const unique_lock< mutex > &  guard)
inline

Unblock all tasks (must hold the lock)

21906 {
21907 VerifyLock(guard);
21908 if (blocked_tasks.empty()) {
21909 return false;
21910 }
21911 for (auto &entry : blocked_tasks) {
21912 entry.Callback();
21913 }
21914 blocked_tasks.clear();
21915 return true;
21916 }

◆ BlockSink()

SinkResultType duckdb::StateWithBlockableTasks::BlockSink ( const unique_lock< mutex > &  guard,
const InterruptState interrupt_state 
)
inline
21918 {
21919 return BlockTask(guard, interrupt_state) ? SinkResultType::BLOCKED : SinkResultType::FINISHED;
21920 }
bool BlockTask(const unique_lock< mutex > &guard, const InterruptState &interrupt_state)
Add a task to 'blocked_tasks' before returning SourceResultType::BLOCKED (must hold the lock)
Definition duckdb.hpp:21891

◆ BlockSource()

SourceResultType duckdb::StateWithBlockableTasks::BlockSource ( const unique_lock< mutex > &  guard,
const InterruptState interrupt_state 
)
inline
21922 {
21923 return BlockTask(guard, interrupt_state) ? SourceResultType::BLOCKED : SourceResultType::FINISHED;
21924 }

◆ VerifyLock()

void duckdb::StateWithBlockableTasks::VerifyLock ( const unique_lock< mutex > &  guard) const
inline
21926 {
21927#ifdef DEBUG
21928 D_ASSERT(guard.mutex() && RefersToSameObject(*guard.mutex(), lock));
21929#endif
21930 }
bool RefersToSameObject(const reference< T > &a, const reference< T > &b)
Returns whether or not two reference wrappers refer to the same object.
Definition duckdb.hpp:2191

Member Data Documentation

◆ can_block

atomic<bool> duckdb::StateWithBlockableTasks::can_block {true}
private

Whether we can block tasks.

21934{true};

The documentation for this class was generated from the following file: