dicrg.hpp¶
-
namespace rg¶
Functions
-
struct QueueGlobal : public rg::QueuePolicy¶
Public Functions
-
inline explicit QueueGlobal(const int num_threads)¶
-
virtual bool pop(const int tid, rg::Point &out)¶
Retrieves the next point from a global priority queue.
Coordinates multiple threads to pop the highest-priority point. If the queue is empty, threads will wait as long as other threads are still active (processing points that might add new neighbours to the queue).
- Parameters:
tid – Thread ID.
out – Populated with the next point if found.
- Returns:
True if a point was retrieved, false if the queue is empty and all threads are idle.
-
inline explicit QueueGlobal(const int num_threads)¶
-
struct QueueLocal : public rg::QueuePolicy¶
Public Functions
-
inline explicit QueueLocal(const int num_threads)¶
-
virtual bool pop(const int tid, rg::Point ¤t)¶
Retrieves the next point for a thread to process, blocking briefly if queues are empty.
First tries the calling thread’s own queue via try_pop_own_q(). If empty, repeatedly attempts to steal from other threads via try_steal_from_other_q() up to a fixed number of idle iterations, sleeping 1ms between attempts.
- Parameters:
tid – Thread ID.
current – Populated with the next point to process if one is found.
- Returns:
True if a point was retrieved, false if all queues remained empty after exhausting idle iterations.
Private Functions
-
bool try_steal_from_other_q(const int tid, rg::Point &out)¶
Attempts to steal the highest-priority point from any other thread’s queue.
Iterates over all queues and pops from the first non-empty one found. The global
steal_mtxis held for the duration to prevent two threads from stealing simultaneously.- Parameters:
tid – Thread ID.
out – Populated with the stolen point if successful.
- Returns:
True if a point was stolen, false if all queues were empty.
-
inline explicit QueueLocal(const int num_threads)¶
-
struct QueuePolicy¶
Subclassed by rg::QueueGlobal, rg::QueueLocal
-
struct QueueGlobal : public rg::QueuePolicy¶