class::sys::TaskManager

class sys::TaskManager
  : public api::WorkObject

The Task Class is used to query the system resources for task attribute information.

It is not used for creating tasks. Use sys::Thread or sys::Sys::launch() to create threads or processes respectively.

Task task;
TaskAttr attr;
do {
  task.get_next(attr);
  if( attr.is_valid() ){
    if( attr.is_enabled() ){
      printf("Task Name is %s\n", attr.name());
    }
  }
} while( attr != TaskAttr::invalid() );

Summary

TaskManager()

~TaskManager()

int count_free()

int count_total()

void finalize()

TaskInfo get_info(

const arg::DeviceThreadId id
)

int get_next(

TaskInfo & attr
)

int get_pid(

const var::ConstString & name
)

int id() const

void initialize()

bool is_pid_running(

const arg::Pid pid
)

void print(

int pid
)

void set_id(

const arg::DeviceThreadId value
)

static TaskInfo get_info()

Members

TaskManager()

~TaskManager()

int count_free()

Returns the total number of tasks that are currently used.


int count_total()

Returns the total number of tasks that can run on the system.


void finalize()

TaskInfo get_info(

const arg::DeviceThreadId id
)

Gets the task attributes for the specifed id.

The code below gets the task information for the currently executing thread.

#include <sapi/sys.hpp>

TaskInfo info;
Task task;

info = task(Thread::self());

int get_next(

TaskInfo & attr
)

Gets the attributes for the next task.

Parameters

  • attr A reference for the destination information.

Returns

  • Zero if there are no more tasks
  • One if the task was successfully read
  • less than zero for an error readin the task

int get_pid(

const var::ConstString & name
)


int id() const

Returns the index of the current task as this object goes through all tasks using get_next().

Use sys::Thread::self() to get the id of the currently executing thread.


void initialize()

bool is_pid_running(

const arg::Pid pid
)


void print(

int pid
)

Prints info for all enabled tasks.


void set_id(

const arg::DeviceThreadId value
)

Sets the task ID value for the get_next() method.

Valid values from from 0 to count_total() - 1.


static TaskInfo get_info()

X

Thanks for Coming!

Subscribe to news and updates