SystemThread Struct Reference

Inheritance diagram for SystemThread

Inheritance graph

Collaboration diagram for SystemThread:

Collaboration graph


Public Methods

bool SystemThread_pause (struct SystemThread *ptr_thread, clock_t timeout)
priority_t SystemThread_get_priority (struct SystemThread *ptr_system_thread)
void SystemThread_set_priority (struct SystemThread *ptr_system_thread, priority_t priority)

Public Attributes

struct Modulemodule


Detailed Description

Base object for all execution units (threads). This object defines the basic object that makes an execution thread.

See also:
Processes and Modules


Member Function Documentation

priority_t SystemThread_get_priority ( struct SystemThread * ptr_system_thread )
 

Returns a thread's priority.

Parameters:
ptr_system_thread   A pointer to the SystemThread initialized object
Returns:
Priority of the thread
       #include <cybiko.h>
       ...
       struct module_t main_module;
       ...
       init_module( &main_module );
       ...
       if( SystemThread_get_priority( main_module.m_process ) <  PR_NORMAL )
           SystemThread_set_priority( main_module.m_process, PR_NORMAL );
       ...
See also:
SystemThread_set_priority, PR_IDLE, PR_NORMAL, PR_RUNTIME.

bool SystemThread_pause ( struct SystemThread * ptr_thread,
clock_t timeout )
 

Pauses execution of the thread.

Parameters:
ptr_thread   A pointer to the SystemThread initialized object
timeout   The time span to sleep, in milliseconds
Returns:
FALSE if the timeout has passed
       #include <cybiko.h>
       ...
       struct module_t main_module;
       ...
       init_module( &main_module );
       ...
       play_tone( 30 );
       SystemThread_pause( main_module.m_process, 200 );
       play_tone( -1 );
       ...

void SystemThread_set_priority ( struct SystemThread * ptr_system_thread,
priority_t priority )
 

Changes the thread's priority.

Parameters:
ptr_system_thread   A pointer to the SystemThread initialized structure
priority   The thread priority, on a scale from PR_IDLE to PR_RUNTIME
Returns:
None
       #include <cybiko.h>
       ...
       struct module_t main_module;
       ...
       init_module( &main_module );
       ...
       if( SystemThread_get_priority( main_module.m_process ) <  PR_NORMAL )
           SystemThread_set_priority( main_module.m_process, PR_NORMAL );
       ...
See also:
SystemThread_get_priority, PR_IDLE, PR_NORMAL, PR_RUNTIME.


Member Data Documentation

struct Module * module
 

Pointer to the module to which the thread belongs.