Click
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
RouterThread Class Reference

A set of Tasks scheduled on the same CPU. More...

Public Types

enum  { THREAD_QUIESCENT = -1 , THREAD_UNKNOWN = -1000 }
 
enum  {
  S_PAUSED , S_BLOCKED , S_TIMERWAIT , S_LOCKSELECT ,
  S_LOCKTASKS , S_RUNTASK , S_RUNTIMER , S_RUNSIGNAL ,
  S_RUNPENDING , S_RUNSELECT , NSTATES
}
 

Public Member Functions

int thread_id () const
 Returns this thread's ID.
 
Master * master () const
 Returns this thread's associated Master.
 
TimerSet & timer_set ()
 
const TimerSet & timer_set () const
 
SelectSet & select_set ()
 
const SelectSet & select_set () const
 
bool active () const
 Returns whether any tasks are scheduled.
 
Task * task_begin () const
 Returns the beginning of the scheduled task list.
 
Task * task_next (Task *task) const
 Returns the task following task in the scheduled task list.
 
Task * task_end () const
 Returns the end of the scheduled task list.
 
void scheduled_tasks (Router *router, Vector< Task * > &x)
 
void lock_tasks ()
 
void unlock_tasks ()
 
void schedule_block_tasks ()
 
void block_tasks (bool scheduled)
 
void unblock_tasks ()
 
bool stop_flag () const
 
void mark_driver_entry ()
 
void driver ()
 
void kill_router (Router *router)
 
bool greedy () const
 
void set_greedy (bool g)
 
void wake ()
 
void run_signals ()
 
void set_thread_state (int state)
 
void set_thread_state_for_blocking (int delay_type)
 

Public Attributes

unsigned _tasks_per_iter
 
unsigned _iters_per_os
 

Detailed Description

A set of Tasks scheduled on the same CPU.

Member Function Documentation

◆ thread_id()

int RouterThread::thread_id ( ) const
inline

Returns this thread's ID.

The result is >= 0 for true threads, and < 0 for threads that never run any of their associated Tasks.

◆ master()

Master * RouterThread::master ( ) const
inline

Returns this thread's associated Master.

◆ active()

bool RouterThread::active ( ) const
inline

Returns whether any tasks are scheduled.

Returns false iff no tasks are scheduled and no events are pending. Since not all events actually matter (for example, a Task might have been scheduled and then subsequently unscheduled), active() may temporarily return true even when no real events are outstanding.

◆ task_begin()

Task * RouterThread::task_begin ( ) const
inline

Returns the beginning of the scheduled task list.

Each RouterThread maintains a list of all currently-scheduled tasks. Elements may traverse this list with the task_begin(), task_next(), and task_end() functions, using iterator-like code such as:

thread->lock_tasks();
for (Task *t = thread->task_begin();
t != thread->task_end();
t = thread->task_next(t)) {
// ... do something with t...
}
thread->unlock_tasks();
Represents a frequently-scheduled computational task.
Definition task.hh:49

The thread's task lock must be held during the traversal, as shown above.

The return value may not be a real task. Test it against task_end() before use.

See also
task_next, task_end, lock_tasks, unlock_tasks

◆ task_next()

Task * RouterThread::task_next ( Task *  task) const
inline

Returns the task following task in the scheduled task list.

Parameters
taskthe current task

The return value may not be a real task. Test it against task_end() before use. However, the task argument must be a real task; do not attempt to call task_next(task_end()).

See also
task_begin for usage, task_end

◆ task_end()

Task * RouterThread::task_end ( ) const
inline

Returns the end of the scheduled task list.

The return value is not a real task.

See also
task_begin for usage, task_next

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