PIOMan

Documentation

PIOMan ltask interface

This is the main PIOMan interface, used to submit light tasks. More...

Collaboration diagram for PIOMan ltask interface:

Data Structures

struct  piom_ltask
 

Macros

#define PIOM_LTASK_OPTION_NONE   0x00
 
#define PIOM_LTASK_OPTION_REPEAT   0x01
 repeat until task completion More...
 
#define PIOM_LTASK_OPTION_ONESHOT   0x02
 task is scheduled once More...
 
#define PIOM_LTASK_OPTION_DESTROY   0x04
 handler destroys the ltask- must be oneshot, without wait More...
 
#define PIOM_LTASK_OPTION_NOWAIT   0x08
 no wait will be performed on the task- bypass completion notification More...
 
#define PIOM_LTASK_OPTION_BLOCKING   0x10
 task has a blocking function More...
 

Typedefs

typedef unsigned piom_ltask_option_t
 
typedef int(* piom_ltask_func_t) (void *arg)
 type for ltask callback function More...
 

Enumerations

enum  piom_ltask_state_t {
  PIOM_LTASK_STATE_NONE = 0x00 , PIOM_LTASK_STATE_READY = 0x01 , PIOM_LTASK_STATE_SCHEDULED = 0x02 , PIOM_LTASK_STATE_SUCCESS = 0x04 ,
  PIOM_LTASK_STATE_TERMINATED = 0x08 , PIOM_LTASK_STATE_DESTROYED = 0x10 , PIOM_LTASK_STATE_BLOCKED = 0x20 , PIOM_LTASK_STATE_CANCELLED = 0x40 ,
  PIOM_LTASK_STATE_MASKED = 0x80
}
 

Functions

int piom_ltask_test_activity (void)
 Tests whether the ltask system is running. More...
 
void piom_ltask_submit (struct piom_ltask *task)
 submit a task Beyond this point, the task may be scheduled at any time More...
 
void piom_ltask_wait_success (struct piom_ltask *task)
 Wait for the completion of a task (ie. More...
 
void piom_ltask_wait (struct piom_ltask *task)
 Wait for the termination of a task (ie. More...
 
void piom_ltask_cancel (struct piom_ltask *task)
 Cancel a task. More...
 
static piom_ltask_state_t piom_ltask_state_set (struct piom_ltask *ltask, piom_ltask_state_t state)
 sets a given bit in a task state. More...
 
static piom_ltask_state_t piom_ltask_state_unset (struct piom_ltask *ltask, piom_ltask_state_t state)
 unsets a given bit in a task state. More...
 
static int piom_ltask_state_test (struct piom_ltask *ltask, piom_ltask_state_t state)
 test a given bit in a task state. More...
 
static void piom_ltask_completed (struct piom_ltask *task)
 Notify task completion. More...
 
static void piom_ltask_destroy (struct piom_ltask *ltask)
 Notify task destruction, if option DESTROY was set. More...
 
static void piom_ltask_init (struct piom_ltask *ltask)
 
static void piom_ltask_create (struct piom_ltask *task, piom_ltask_func_t func_ptr, void *data_ptr, piom_ltask_option_t options)
 create a new ltask. More...
 
static void piom_ltask_set_binding (struct piom_ltask *task, piom_topo_obj_t binding)
 
void piom_ltask_set_blocking (struct piom_ltask *task, piom_ltask_func_t func, int delay_usec)
 
static void piom_ltask_set_name (struct piom_ltask *ltask, const char *name)
 
static void piom_ltask_set_destructor (struct piom_ltask *ltask, void(*destructor)(struct piom_ltask *))
 
void piom_ltask_poll_level_set (int level)
 set the polling level- 0 for low; 1 for high More...
 
int piom_ltask_poll_level_get (void)
 
void piom_ltask_mask (struct piom_ltask *ltask)
 suspend the ltask scheduling More...
 
void piom_ltask_unmask (struct piom_ltask *ltask)
 re-enable a previously masked ltask More...
 
int piom_ltask_cancel_request (struct piom_ltask *ltask)
 asynchronously request task cancellation More...
 
void piom_ltask_cancel_wait (struct piom_ltask *ltask)
 wait for cancellation completion More...
 
void piom_ltask_cancel_immediate (struct piom_ltask *ltask)
 immediately cancel the ltask, without waiting for the scheduler to flush it from the queue More...
 
void piom_ltask_assert_noschedule (void)
 assert we are not called from an ltask schedule context; only in DEBUG mode More...
 
void piom_ltask_check_wait (void)
 check that we are in a context where we can wait More...
 

Detailed Description

This is the main PIOMan interface, used to submit light tasks.

Macro Definition Documentation

◆ PIOM_LTASK_OPTION_BLOCKING

#define PIOM_LTASK_OPTION_BLOCKING   0x10

task has a blocking function

Definition at line 46 of file piom_ltask.h.

◆ PIOM_LTASK_OPTION_DESTROY

#define PIOM_LTASK_OPTION_DESTROY   0x04

handler destroys the ltask- must be oneshot, without wait

Definition at line 44 of file piom_ltask.h.

◆ PIOM_LTASK_OPTION_NONE

#define PIOM_LTASK_OPTION_NONE   0x00

Definition at line 41 of file piom_ltask.h.

◆ PIOM_LTASK_OPTION_NOWAIT

#define PIOM_LTASK_OPTION_NOWAIT   0x08

no wait will be performed on the task- bypass completion notification

Definition at line 45 of file piom_ltask.h.

◆ PIOM_LTASK_OPTION_ONESHOT

#define PIOM_LTASK_OPTION_ONESHOT   0x02

task is scheduled once

Definition at line 43 of file piom_ltask.h.

◆ PIOM_LTASK_OPTION_REPEAT

#define PIOM_LTASK_OPTION_REPEAT   0x01

repeat until task completion

Definition at line 42 of file piom_ltask.h.

Typedef Documentation

◆ piom_ltask_func_t

typedef int(* piom_ltask_func_t) (void *arg)

type for ltask callback function

Definition at line 62 of file piom_ltask.h.

◆ piom_ltask_option_t

typedef unsigned piom_ltask_option_t

Definition at line 40 of file piom_ltask.h.

Enumeration Type Documentation

◆ piom_ltask_state_t

Enumerator
PIOM_LTASK_STATE_NONE 

not yet submitted

PIOM_LTASK_STATE_READY 

submitted to a queue, ready to be scheduled

PIOM_LTASK_STATE_SCHEDULED 

being scheduled

PIOM_LTASK_STATE_SUCCESS 

task has been scheduled and is successfull

PIOM_LTASK_STATE_TERMINATED 

task is successfull and processing is completed; resources may be freed

PIOM_LTASK_STATE_DESTROYED 

task destroyed by user handler

PIOM_LTASK_STATE_BLOCKED 

task is blocked on syscall

PIOM_LTASK_STATE_CANCELLED 
PIOM_LTASK_STATE_MASKED 

task is temporarily disabled

Definition at line 48 of file piom_ltask.h.

Function Documentation

◆ piom_ltask_assert_noschedule()

void piom_ltask_assert_noschedule ( void  )

assert we are not called from an ltask schedule context; only in DEBUG mode

◆ piom_ltask_cancel()

void piom_ltask_cancel ( struct piom_ltask task)

Cancel a task.

Slow! Use only for clean shutdown.

◆ piom_ltask_cancel_immediate()

void piom_ltask_cancel_immediate ( struct piom_ltask ltask)

immediately cancel the ltask, without waiting for the scheduler to flush it from the queue

◆ piom_ltask_cancel_request()

int piom_ltask_cancel_request ( struct piom_ltask ltask)

asynchronously request task cancellation

Returns
1 if task already completed in-between; 0 otherwise

◆ piom_ltask_cancel_wait()

void piom_ltask_cancel_wait ( struct piom_ltask ltask)

wait for cancellation completion

◆ piom_ltask_check_wait()

void piom_ltask_check_wait ( void  )

check that we are in a context where we can wait

◆ piom_ltask_completed()

static void piom_ltask_completed ( struct piom_ltask task)
inlinestatic

Notify task completion.

< no wait will be performed on the task- bypass completion notification

Definition at line 146 of file piom_ltask.h.

References done, options, piom_cond_signal(), PIOM_LTASK_OPTION_NOWAIT, piom_ltask_state_set(), and PIOM_LTASK_STATE_SUCCESS.

Here is the call graph for this function:

◆ piom_ltask_create()

static void piom_ltask_create ( struct piom_ltask task,
piom_ltask_func_t  func_ptr,
void *  data_ptr,
piom_ltask_option_t  options 
)
inlinestatic

create a new ltask.

< repeat until task completion

< task is scheduled once

< task is scheduled once

< handler destroys the ltask- must be oneshot, without wait

Definition at line 169 of file piom_ltask.h.

References binding, blocking_func, data_ptr, destructor, done, func_ptr, name, options, piom_cond_init(), PIOM_LTASK_OPTION_DESTROY, PIOM_LTASK_OPTION_ONESHOT, PIOM_LTASK_OPTION_REPEAT, PIOM_LTASK_STATE_NONE, queue, and state.

Here is the call graph for this function:

◆ piom_ltask_destroy()

static void piom_ltask_destroy ( struct piom_ltask ltask)
inlinestatic

Notify task destruction, if option DESTROY was set.

Definition at line 156 of file piom_ltask.h.

References PIOM_LTASK_STATE_BLOCKED, PIOM_LTASK_STATE_DESTROYED, PIOM_LTASK_STATE_SCHEDULED, and state.

◆ piom_ltask_init()

static void piom_ltask_init ( struct piom_ltask ltask)
inlinestatic

Definition at line 162 of file piom_ltask.h.

References PIOM_LTASK_STATE_NONE, queue, and state.

◆ piom_ltask_mask()

void piom_ltask_mask ( struct piom_ltask ltask)

suspend the ltask scheduling

Note
blocks if the ltask is currently scheduled

◆ piom_ltask_poll_level_get()

int piom_ltask_poll_level_get ( void  )

◆ piom_ltask_poll_level_set()

void piom_ltask_poll_level_set ( int  level)

set the polling level- 0 for low; 1 for high

◆ piom_ltask_set_binding()

static void piom_ltask_set_binding ( struct piom_ltask task,
piom_topo_obj_t  binding 
)
inlinestatic

Definition at line 188 of file piom_ltask.h.

References binding.

◆ piom_ltask_set_blocking()

void piom_ltask_set_blocking ( struct piom_ltask task,
piom_ltask_func_t  func,
int  delay_usec 
)

◆ piom_ltask_set_destructor()

static void piom_ltask_set_destructor ( struct piom_ltask ltask,
void(*)(struct piom_ltask *)  destructor 
)
inlinestatic

< no wait will be performed on the task- bypass completion notification

Definition at line 200 of file piom_ltask.h.

References destructor, options, and PIOM_LTASK_OPTION_NOWAIT.

◆ piom_ltask_set_name()

static void piom_ltask_set_name ( struct piom_ltask ltask,
const char *  name 
)
inlinestatic

Definition at line 195 of file piom_ltask.h.

References name.

◆ piom_ltask_state_set()

static piom_ltask_state_t piom_ltask_state_set ( struct piom_ltask ltask,
piom_ltask_state_t  state 
)
inlinestatic

sets a given bit in a task state.

Returns
the new state

Definition at line 109 of file piom_ltask.h.

References state.

Referenced by piom_ltask_completed().

Here is the caller graph for this function:

◆ piom_ltask_state_test()

static int piom_ltask_state_test ( struct piom_ltask ltask,
piom_ltask_state_t  state 
)
inlinestatic

test a given bit in a task state.

Definition at line 140 of file piom_ltask.h.

References state.

◆ piom_ltask_state_unset()

static piom_ltask_state_t piom_ltask_state_unset ( struct piom_ltask ltask,
piom_ltask_state_t  state 
)
inlinestatic

unsets a given bit in a task state.

Returns
the new state

Definition at line 125 of file piom_ltask.h.

References state.

◆ piom_ltask_submit()

void piom_ltask_submit ( struct piom_ltask task)

submit a task Beyond this point, the task may be scheduled at any time

◆ piom_ltask_test_activity()

int piom_ltask_test_activity ( void  )

Tests whether the ltask system is running.

return 1 if running, 0 otherwise

◆ piom_ltask_unmask()

void piom_ltask_unmask ( struct piom_ltask ltask)

re-enable a previously masked ltask

◆ piom_ltask_wait()

void piom_ltask_wait ( struct piom_ltask task)

Wait for the termination of a task (ie.

wait until the task state matches PIOM_LTASK_STATE_TERMINATED)

◆ piom_ltask_wait_success()

void piom_ltask_wait_success ( struct piom_ltask task)

Wait for the completion of a task (ie.

wait until the task state matches PIOM_LTASK_STATE_SUCCESS)