Main Page | Modules | Data Structures | Data Fields

Task common
[Task]


Detailed Description

Task common stuffs.


Typedefs

typedef __peak_task * peak_task
 Opaque task type.

typedef enum _peak_task_flavor_e peak_task_flavor_t
 Task info's flavors.


Enumerations

enum  _peak_task_flavor_e {
  PEAK_TASK_FLAVOR_NTHREADS,
  PEAK_TASK_FLAVOR_MAXFDS
}
 Task info's flavors. More...


Functions

peak_task peak_task_self (void)
 Get the owning task of the current execution stream.

int peak_task_get_info (peak_task task, peak_task_flavor_t flavor, int *info)
 Get task information.

int peak_task_set_info (peak_task task, peak_task_flavor_t flavor, int *info)
 Set task information.

const char * peak_task_get_engine_name (peak_task task)
 Get task's underlying engine name.

void peak_task_run (peak_task task)
 Enter and process the event loop.

void peak_task_break (peak_task task)
 Terminate task's event loop.


Typedef Documentation

typedef struct __peak_task* peak_task
 

Opaque task type.

One task to rule them all...

typedef enum _peak_task_flavor_e peak_task_flavor_t
 

Task info's flavors.

See the documentation for the enumeration _peak_task_flavor_e.


Enumeration Type Documentation

enum _peak_task_flavor_e
 

Task info's flavors.

Enumeration values:
PEAK_TASK_FLAVOR_NTHREADS  Specify the number of threads a task should run.

Info's value
Use 0 for automatic detection which depends on the number of available CPUs when you *run* the application.
PEAK_TASK_FLAVOR_MAXFDS  Specify the max number of open files allowed.

This defines only the max number of open files allowed to open by the PEAK library and doesn't count application-level file descriptors. WARNING: This is not true when using the basic select() engine, due to an implementation limitation.

Info's value
Use 0 to set the default specified at the library compile time (usually 256).


Function Documentation

void peak_task_break peak_task  task  ) 
 

Terminate task's event loop.

This is done asynchronously: the engine waits for events being currently processed and the blocked peak_task_run() exits.

Parameters:
task The task to break (usually peak_task_self()).

const char* peak_task_get_engine_name peak_task  task  ) 
 

Get task's underlying engine name.

Parameters:
task The task reference.
Returns:
A pointer to the name of engine (constant).

int peak_task_get_info peak_task  task,
peak_task_flavor_t  flavor,
int *  info
 

Get task information.

Parameters:
task The task reference.
flavor One of the available flavor.
info A pointer to a varying array of int, depending on the flavor. You must properly allocate it.
Returns:
0 if successful

void peak_task_run peak_task  task  ) 
 

Enter and process the event loop.

Block the task's master thread if no event to process nor timers to fire are found. If called with peak_task_self(), blocks the current thread and use it as the master thread.
Returns only if there is nothing to process (ie. no timer, no registered signal, no object scheduled) or after a call to peak_task_break().
Usually called once at the beginning (after initializations).

Parameters:
task The task to run (usually peak_task_self()).

peak_task peak_task_self void   ) 
 

Get the owning task of the current execution stream.

A task can have several threads, but this function will reference the same task in all of them.

int peak_task_set_info peak_task  task,
peak_task_flavor_t  flavor,
int *  info
 

Set task information.

Parameters:
task The task reference.
flavor One of the available flavor.
info A pointer to a varying array of int, depending on the flavor, containing the value you want to set.
Returns:
0 if successful


Generated on Thu Jan 8 18:16:24 2004 for the PEAK Library by doxygen     SourceForge.net Logo