quic/qbox
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gs::runonsysc Class Reference
Inheritance diagram for gs::runonsysc:
Inheritance graph
[legend]
Collaboration diagram for gs::runonsysc:
Collaboration graph
[legend]

Classes

class  AsyncJob
 

Public Member Functions

 runonsysc (const sc_core::sc_module_name &n=sc_core::sc_module_name("run-on-sysc"))
 
void cancel_pendings ()
 Cancel all pending jobs.
 
void cancel_all ()
 Cancel all pending and running jobs.
 
void stop ()
 
void end_of_simulation ()
 
void fork_on_systemc (std::function< void()> job_entry)
 
bool run_on_sysc (std::function< void()> job_entry, bool wait=true)
 Run a job on the SystemC kernel thread.
 
bool is_on_sysc () const
 

Protected Member Functions

void jobs_handler ()
 
void cancel_pendings_locked ()
 

Protected Attributes

std::thread::id m_thread_id
 
std::queue< AsyncJob::Ptr > m_async_jobs
 
AsyncJob::Ptr m_running_job
 
std::mutex m_async_jobs_mutex
 
async_event m_jobs_handler_event
 
std::atomic< boolrunning = true
 

Member Function Documentation

◆ cancel_all()

void gs::runonsysc::cancel_all ( )
inline

Cancel all pending and running jobs.

@detail Cancel all the pending jobs and the currently running job. The callers will be unblocked if they are waiting for the job. Note that if the currently running job is resumed, the behaviour is undefined. This method is meant to be called after simulation has ended.

◆ cancel_pendings()

void gs::runonsysc::cancel_pendings ( )
inline

Cancel all pending jobs.

@detail Cancel all the pending jobs. The callers will be unblocked if they are waiting for the job.

◆ is_on_sysc()

bool gs::runonsysc::is_on_sysc ( ) const
inline
Returns
Whether we are on SystemC thread

◆ run_on_sysc()

bool gs::runonsysc::run_on_sysc ( std::function< void()>  job_entry,
bool  wait = true 
)
inline

Run a job on the SystemC kernel thread.

Parameters
[in]job_entryThe job to run
[in]waitIf true, wait for job completion
Returns
true if the job has been succesfully executed or if wait was false, false if it has been cancelled (see RunOnSysC::cancel_all).

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