Talvos  0.1
SPIR-V interpreter and dynamic analysis framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
talvos::Queue Class Reference

This class represents a queue for executing commands on a device. More...

#include <talvos/Queue.h>

Public Member Functions

 Queue (Device &Dev)
 Create a queue for the specified device. More...
 
 ~Queue ()
 Destroy the queue. More...
 
void submit (const std::vector< Command * > &NewCommands, volatile bool *Fence=nullptr)
 Submit a batch of commands to the queue. More...
 
void waitIdle ()
 Wait until all commands in the queue have completed. More...
 
 Queue (const Queue &)=delete
 
Queueoperator= (const Queue &)=delete
 

Private Member Functions

void run ()
 Entry point for background queue thread. More...
 

Private Attributes

DeviceDev
 The device that this queue will execute work on. More...
 
std::queue< Command * > Commands
 The queue of pending commands. More...
 
std::set< volatile bool * > Fences
 A set of pending fences. More...
 
std::thread Thread
 
std::mutex Mutex
 Mutex used to guard queue updates. More...
 
std::condition_variable StateChanged
 Condition variable to signal when queue state has changed. More...
 
volatile bool Running
 Flag to signal whether the queue thread is active. More...
 

Detailed Description

This class represents a queue for executing commands on a device.

Definition at line 25 of file Queue.h.

Constructor & Destructor Documentation

talvos::Queue::Queue ( Device Dev)

Create a queue for the specified device.

Definition at line 18 of file Queue.cpp.

talvos::Queue::~Queue ( )

Destroy the queue.

Definition at line 24 of file Queue.cpp.

talvos::Queue::Queue ( const Queue )
delete

Member Function Documentation

Queue& talvos::Queue::operator= ( const Queue )
delete
void talvos::Queue::run ( )
private

Entry point for background queue thread.

Definition at line 58 of file Queue.cpp.

void talvos::Queue::submit ( const std::vector< Command * > &  NewCommands,
volatile bool *  Fence = nullptr 
)

Submit a batch of commands to the queue.

If Fence is not nullptr, its pointee will be set to true when all of the commands have completed.

Definition at line 37 of file Queue.cpp.

void talvos::Queue::waitIdle ( )

Wait until all commands in the queue have completed.

Definition at line 104 of file Queue.cpp.

Member Data Documentation

std::queue<Command *> talvos::Queue::Commands
private

The queue of pending commands.

Definition at line 54 of file Queue.h.

Device& talvos::Queue::Dev
private

The device that this queue will execute work on.

Definition at line 51 of file Queue.h.

std::set<volatile bool *> talvos::Queue::Fences
private

A set of pending fences.

Definition at line 57 of file Queue.h.

std::mutex talvos::Queue::Mutex
private

Mutex used to guard queue updates.

Definition at line 63 of file Queue.h.

volatile bool talvos::Queue::Running
private

Flag to signal whether the queue thread is active.

Definition at line 69 of file Queue.h.

std::condition_variable talvos::Queue::StateChanged
private

Condition variable to signal when queue state has changed.

Definition at line 66 of file Queue.h.

std::thread talvos::Queue::Thread
private

Definition at line 60 of file Queue.h.