GNU Radio 3.6.5 C++ API

gruel Namespace Reference

Include this header to use the message passing features. More...

Classes

class  msg_accepter
 Virtual base class that accepts messages. More...
class  msg_accepter_msgq
 Concrete class that accepts messages and inserts them into a message queue. More...
class  msg_queue
 thread-safe message queue More...
struct  rt_sched_param
struct  sys_pri
class  thread_body_wrapper
class  thread_group

Typedefs

typedef signed long long high_res_timer_type
 Typedef for the timer tick count.
typedef boost::thread thread
typedef boost::mutex mutex
typedef boost::unique_lock
< boost::mutex > 
scoped_lock
typedef boost::condition_variable condition_variable
typedef pthread_t gr_thread_t
 a system-dependent typedef for the underlying thread type.

Enumerations

enum  rt_status_t { RT_OK = 0, RT_NOT_IMPLEMENTED, RT_NO_PRIVS, RT_OTHER_ERROR }
enum  rt_sched_policy { RT_SCHED_RR = 0, RT_SCHED_FIFO = 1 }

Functions

high_res_timer_type high_res_timer_now (void)
 Get the current time in ticks.
high_res_timer_type high_res_timer_tps (void)
 Get the number of ticks per second.
high_res_timer_type high_res_timer_epoch (void)
 Get the tick count at the epoch.
static pmt::pmt_t send (msg_accepter_sptr accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg)
 send message to msg_accepter
static pmt::pmt_t send (msg_accepter *accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg)
 send message to msg_accepter
static pmt::pmt_t send (msg_accepter &accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg)
 send message to msg_accepter
static pmt::pmt_t send (pmt::pmt_t accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg)
 send message to msg_accepter
msg_queue_sptr make_msg_queue (unsigned int limit=0)
static int rt_priority_min ()
static int rt_priority_max ()
static int rt_priority_default ()
rt_status_t GRUEL_API enable_realtime_scheduling (rt_sched_param=rt_sched_param())
 If possible, enable "realtime" scheduling.In general, this means that the code will be scheduled before any non-realtime (normal) processes. Note that if your code contains an non-blocking infinite loop and you enable realtime scheduling, it's possible to hang the system.
GRUEL_API gr_thread_t get_current_thread_id ()
 Get the current thread's ID as a gr_thread_t.
GRUEL_API void thread_bind_to_processor (const std::vector< int > &mask)
 Bind the current thread to a set of cores.
GRUEL_API void thread_bind_to_processor (int n)
 Convineince function to bind the current thread to a single core.
GRUEL_API void thread_bind_to_processor (gr_thread_t thread, const std::vector< int > &mask)
 Bind a thread to a set of cores.
GRUEL_API void thread_bind_to_processor (gr_thread_t thread, unsigned int n)
 Convineince function to bind the a thread to a single core.
GRUEL_API void thread_unbind ()
 Remove any thread-processor affinity for the current thread.
GRUEL_API void thread_unbind (gr_thread_t thread)
 Remove any thread-processor affinity for a given thread ID.
GRUEL_API void mask_signals ()

Detailed Description

Include this header to use the message passing features.

System independent way to ask for realtime scheduling.

See also:
sys_pri.h

Typedef Documentation

typedef boost::condition_variable gruel::condition_variable
typedef pthread_t gruel::gr_thread_t

a system-dependent typedef for the underlying thread type.

typedef signed long long gruel::high_res_timer_type

Typedef for the timer tick count.

typedef boost::mutex gruel::mutex
typedef boost::unique_lock<boost::mutex> gruel::scoped_lock
typedef boost::thread gruel::thread

Enumeration Type Documentation

Enumerator:
RT_SCHED_RR 
RT_SCHED_FIFO 
Enumerator:
RT_OK 
RT_NOT_IMPLEMENTED 
RT_NO_PRIVS 
RT_OTHER_ERROR 

Function Documentation

GRUEL_API gr_thread_t gruel::get_current_thread_id ( )

Get the current thread's ID as a gr_thread_t.

We use this when setting the thread affinity or any other low-level thread settings. Can be called withing a GNU Radio block to get a reference to its current thread ID.

gruel::high_res_timer_type gruel::high_res_timer_epoch ( void  ) [inline]

Get the tick count at the epoch.

References high_res_timer_now(), and high_res_timer_tps().

gruel::high_res_timer_type gruel::high_res_timer_now ( void  ) [inline]

Get the current time in ticks.

Referenced by high_res_timer_epoch().

gruel::high_res_timer_type gruel::high_res_timer_tps ( void  ) [inline]

Get the number of ticks per second.

Referenced by high_res_timer_epoch().

msg_queue_sptr gruel::make_msg_queue ( unsigned int  limit = 0)
GRUEL_API void gruel::mask_signals ( )
static int gruel::rt_priority_default ( ) [inline, static]
static int gruel::rt_priority_max ( ) [inline, static]
static int gruel::rt_priority_min ( ) [inline, static]
static pmt::pmt_t gruel::send ( msg_accepter_sptr  accepter,
const pmt::pmt_t which_port,
const pmt::pmt_t msg 
) [inline, static]

send message to msg_accepter

Parameters:
accepteris the target of the send.
which_portA pmt symbol describing the port by name.
msgis the message to send. It's usually a pmt tuple.

Sending a message is an asynchronous operation. The send call will not wait for the message either to arrive at the destination or to be received.

Returns:
msg

Referenced by send().

static pmt::pmt_t gruel::send ( msg_accepter &  accepter,
const pmt::pmt_t which_port,
const pmt::pmt_t msg 
) [inline, static]

send message to msg_accepter

Parameters:
accepteris the target of the send.
which_portA pmt symbol describing the port by name.
msgis the message to send. It's usually a pmt tuple.

Sending a message is an asynchronous operation. The send call will not wait for the message either to arrive at the destination or to be received.

Returns:
msg

References gruel::msg_accepter::post().

static pmt::pmt_t gruel::send ( msg_accepter *  accepter,
const pmt::pmt_t which_port,
const pmt::pmt_t msg 
) [inline, static]

send message to msg_accepter

Parameters:
accepteris the target of the send.
which_portA pmt symbol describing the port by name.
msgis the message to send. It's usually a pmt tuple.

Sending a message is an asynchronous operation. The send call will not wait for the message either to arrive at the destination or to be received.

Returns:
msg

References gruel::msg_accepter::post().

static pmt::pmt_t gruel::send ( pmt::pmt_t  accepter,
const pmt::pmt_t which_port,
const pmt::pmt_t msg 
) [inline, static]

send message to msg_accepter

Parameters:
accepteris the target of the send. precond: pmt_is_msg_accepter(accepter)
which_portA pmt symbol describing the port by name.
msgis the message to send. It's usually a pmt tuple.

Sending a message is an asynchronous operation. The send call will not wait for the message either to arrive at the destination or to be received.

Returns:
msg

References pmt::pmt_msg_accepter_ref(), and send().

GRUEL_API void gruel::thread_bind_to_processor ( int  n)

Convineince function to bind the current thread to a single core.

Wrapper for system-dependent calls to set the affinity of the current thread to a given core from 0 to N-1 for N cores.

Note: this does not work on OSX; it is a nop call since OSX does not support the concept of thread affinity (and what they do support in this way since 10.5 is not what we want or can use in this fashion).

GRUEL_API void gruel::thread_bind_to_processor ( gr_thread_t  thread,
unsigned int  n 
)

Convineince function to bind the a thread to a single core.

Wrapper for system-dependent calls to set the affinity of the given thread ID to a given core from 0 to N-1 for N cores.

Note: this does not work on OSX; it is a nop call since OSX does not support the concept of thread affinity (and what they do support in this way since 10.5 is not what we want or can use in this fashion).

GRUEL_API void gruel::thread_bind_to_processor ( const std::vector< int > &  mask)

Bind the current thread to a set of cores.

Wrapper for system-dependent calls to set the affinity of the current thread to the processor mask. The mask is simply a 1-demensional vector containing the processor or core number from 0 to N-1 for N cores.

Note: this does not work on OSX; it is a nop call since OSX does not support the concept of thread affinity (and what they do support in this way since 10.5 is not what we want or can use in this fashion).

GRUEL_API void gruel::thread_bind_to_processor ( gr_thread_t  thread,
const std::vector< int > &  mask 
)

Bind a thread to a set of cores.

Wrapper for system-dependent calls to set the affinity of the given thread ID to the processor mask. The mask is simply a 1-demensional vector containing the processor or core number from 0 to N-1 for N cores.

Note: this does not work on OSX; it is a nop call since OSX does not support the concept of thread affinity (and what they do support in this way since 10.5 is not what we want or can use in this fashion).

GRUEL_API void gruel::thread_unbind ( gr_thread_t  thread)

Remove any thread-processor affinity for a given thread ID.

Note: this does not work on OSX; it is a nop call since OSX does not support the concept of thread affinity (and what they do support in this way since 10.5 is not what we want or can use in this fashion).

GRUEL_API void gruel::thread_unbind ( )

Remove any thread-processor affinity for the current thread.

Note: this does not work on OSX; it is a nop call since OSX does not support the concept of thread affinity (and what they do support in this way since 10.5 is not what we want or can use in this fashion).