Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::BackgroundThread Class Reference

Utility class running deferred work on a single background thread. More...

#include <AMReX_BackgroundThread.H>

Public Member Functions

 BackgroundThread ()
 Launch the worker thread and initialize synchronization primitives.
 
 ~BackgroundThread ()
 Stop the worker thread and drain any queued work.
 
 BackgroundThread (BackgroundThread const &)=delete
 
 BackgroundThread (BackgroundThread &&)=delete
 
BackgroundThreadoperator= (BackgroundThread const &)=delete
 
BackgroundThreadoperator= (BackgroundThread &&)=delete
 
void Submit (std::function< void()> &&a_f)
 Enqueue a job that will run asynchronously on the worker thread.
 
void Submit (std::function< void()> const &a_f)
 
void Finish ()
 Block the caller until all queued jobs have completed.
 

Detailed Description

Utility class running deferred work on a single background thread.

Constructor & Destructor Documentation

◆ BackgroundThread() [1/3]

amrex::BackgroundThread::BackgroundThread ( )

Launch the worker thread and initialize synchronization primitives.

◆ ~BackgroundThread()

amrex::BackgroundThread::~BackgroundThread ( )

Stop the worker thread and drain any queued work.

◆ BackgroundThread() [2/3]

amrex::BackgroundThread::BackgroundThread ( BackgroundThread const &  )
delete

◆ BackgroundThread() [3/3]

amrex::BackgroundThread::BackgroundThread ( BackgroundThread &&  )
delete

Member Function Documentation

◆ Finish()

void amrex::BackgroundThread::Finish ( )

Block the caller until all queued jobs have completed.

◆ operator=() [1/2]

BackgroundThread & amrex::BackgroundThread::operator= ( BackgroundThread &&  )
delete

◆ operator=() [2/2]

BackgroundThread & amrex::BackgroundThread::operator= ( BackgroundThread const &  )
delete

◆ Submit() [1/2]

void amrex::BackgroundThread::Submit ( std::function< void()> &&  a_f)

Enqueue a job that will run asynchronously on the worker thread.

Parameters
a_fFunctor representing the work to execute.

◆ Submit() [2/2]

void amrex::BackgroundThread::Submit ( std::function< void()> const &  a_f)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.


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