GNU Radio 3.4.0 C++ API

Abstract class that manages SPE jobs.There is typically a single instance derived from this class. It is safe to call its methods from any thread. More...

#include <gc_job_manager.h>

Inheritance diagram for gc_job_manager:

List of all members.

Public Member Functions

 gc_job_manager (const gc_jm_options *options=0)
virtual ~gc_job_manager ()
virtual bool shutdown ()=0
virtual int nspes () const =0
 Return number of SPE's currently allocated to job manager.
virtual gc_job_descalloc_job_desc ()=0
 Return a pointer to a properly aligned job descriptor, or throws gc_bad_alloc if there are none available.
virtual void free_job_desc (gc_job_desc *jd)=0
virtual bool submit_job (gc_job_desc *jd)=0
 Submit a job for asynchronous processing on an SPE.
virtual bool wait_job (gc_job_desc *jd)=0
 Wait for job to complete.
virtual int wait_jobs (unsigned int njobs, gc_job_desc *jd[], bool done[], gc_wait_mode mode)=0
 wait for 1 or more jobs to complete.
virtual int ea_args_maxsize ()=0
virtual gc_proc_id_t lookup_proc (const std::string &proc_name)=0
virtual std::vector< std::string > proc_names ()=0

Static Public Member Functions

static void set_singleton (gc_job_manager_sptr mgr)
 Set the singleton gc_job_manager instance.
static gc_job_manager_sptr singleton ()
 Retrieve the singleton gc_job_manager instance.
static gc_job_desc_sptr alloc_job_desc (gc_job_manager_sptr mgr)
 allocate a job descriptor and return a boost::shared_ptr to it.

Detailed Description

Abstract class that manages SPE jobs.

There is typically a single instance derived from this class. It is safe to call its methods from any thread.


Constructor & Destructor Documentation

gc_job_manager::gc_job_manager ( const gc_jm_options options = 0)
virtual gc_job_manager::~gc_job_manager ( ) [virtual]

Member Function Documentation

virtual gc_job_desc* gc_job_manager::alloc_job_desc ( ) [pure virtual]

Return a pointer to a properly aligned job descriptor, or throws gc_bad_alloc if there are none available.

Implemented in gc_job_manager_impl.

static gc_job_desc_sptr gc_job_manager::alloc_job_desc ( gc_job_manager_sptr  mgr) [static]

allocate a job descriptor and return a boost::shared_ptr to it.

virtual int gc_job_manager::ea_args_maxsize ( ) [pure virtual]

Return the maximum number of bytes of EA arguments that may be copied to or from the SPE in a single job. The limit applies independently to the "get" and "put" args.

See also:
gc_job_desc_t, gc_job_ea_args_t

Implemented in gc_job_manager_impl.

virtual void gc_job_manager::free_job_desc ( gc_job_desc jd) [pure virtual]

Implemented in gc_job_manager_impl.

virtual gc_proc_id_t gc_job_manager::lookup_proc ( const std::string &  proc_name) [pure virtual]

Return gc_proc_id_t associated with spu procedure proc_name if one exists, otherwise throws gc_unknown_proc.

Implemented in gc_job_manager_impl.

virtual int gc_job_manager::nspes ( ) const [pure virtual]

Return number of SPE's currently allocated to job manager.

Implemented in gc_job_manager_impl.

virtual std::vector<std::string> gc_job_manager::proc_names ( ) [pure virtual]

Return a vector of all known spu procedure names.

Implemented in gc_job_manager_impl.

static void gc_job_manager::set_singleton ( gc_job_manager_sptr  mgr) [static]

Set the singleton gc_job_manager instance.

Parameters:
mgris the job manager instance.

The singleton is weakly held, thus the caller must maintain a reference to the mgr for the duration. (If we held the manager strongly, the destructor would never be called, and the resources (SPEs) would not be returned.) Bottom line: the caller is responsible for life-time management.

virtual bool gc_job_manager::shutdown ( ) [pure virtual]

Stop accepting new jobs. Wait for existing jobs to complete. Return all managed SPE's to the system.

Implemented in gc_job_manager_impl.

static gc_job_manager_sptr gc_job_manager::singleton ( ) [static]

Retrieve the singleton gc_job_manager instance.

Returns the singleton gc_job_manager instance or raises boost::bad_weak_ptr if the singleton is empty.

virtual bool gc_job_manager::submit_job ( gc_job_desc jd) [pure virtual]

Submit a job for asynchronous processing on an SPE.

Parameters:
[in]jdpointer to job description

The caller must not read or write the job description or any of the memory associated with any indirect arguments until after calling wait_job.

Returns:
true iff the job was successfully enqueued. If submit_job returns false, check jd->status for additional info.

Implemented in gc_job_manager_impl.

virtual bool gc_job_manager::wait_job ( gc_job_desc jd) [pure virtual]

Wait for job to complete.

A thread may only wait for jobs which it submitted.

Returns:
true if sucessful, else false.

Implemented in gc_job_manager_impl.

virtual int gc_job_manager::wait_jobs ( unsigned int  njobs,
gc_job_desc jd[],
bool  done[],
gc_wait_mode  mode 
) [pure virtual]

wait for 1 or more jobs to complete.

Parameters:
[in]njobsis the length of arrays jd and done.
[in]jdare the jobs that are to be waited for.
[out]doneindicates whether the corresponding job is complete.
[in]modeindicates whether to wait for ALL or ANY of the jobs in jd to complete.

A thread may only wait for jobs which it submitted.

Returns:
number of jobs completed, or -1 if error. The caller must examine the status field of each job to confirm successful completion of the job.

Implemented in gc_job_manager_impl.


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