IntrOS
Loading...
Searching...
No Matches
Job queue

job queues (procedures executed by the receiving task) More...

Macros

#define OS_JOB_BUFFER(buf, size)
 define job queue data buffer
#define OS_JOB(job, limit)
 define and initialize a job queue object
#define static_JOB(job, limit)
 static alias of OS_JOB()
#define JOB_INIT(limit)
 create and initialize a job queue object
#define JOB_CREATE(limit)
 create and initialize a job queue object
#define JOB_NEW   JOB_CREATE
 alias of JOB_CREATE()

Functions

void job_init (job_t *job, fun_t **data, size_t bufsize)
 initialize a job queue object
void job_reset (job_t *job)
 reset the job queue object and wake up all waiting tasks with 'E_STOPPED' event
void job_kill (job_t *job)
 alias of job_reset()
int job_take (job_t *job)
 try to transfer job data from the job queue object and execute the job procedure, don't wait if the job queue object is empty
int job_tryWait (job_t *job)
 alias of job_take()
int job_takeAsync (job_t *job)
 Async alias of job_take().
int job_waitFor (job_t *job, cnt_t delay)
 try to transfer job data from the job queue object and execute the job procedure, wait for given duration of time while the job queue object is empty
int job_waitUntil (job_t *job, cnt_t time)
 try to transfer job data from the job queue object and execute the job procedure, wait until given timepoint while the job queue object is empty
int job_wait (job_t *job)
 try to transfer job data from the job queue object and execute the job procedure, wait indefinitely while the job queue object is empty
int job_waitAsync (job_t *job)
 Async alias of job_wait().
int job_give (job_t *job, fun_t *fun)
 try to transfer job data to the job queue object, don't wait if the job queue object is full
int job_giveAsync (job_t *job, fun_t *fun)
 Async alias of job_give().
int job_sendFor (job_t *job, fun_t *fun, cnt_t delay)
 try to transfer job data to the job queue object, wait for given duration of time while the job queue object is full
int job_sendUntil (job_t *job, fun_t *fun, cnt_t time)
 try to transfer job data to the job queue object, wait until given timepoint while the job queue object is full
int job_send (job_t *job, fun_t *fun)
 try to transfer job data to the job queue object, wait indefinitely while the job queue object is full
int job_sendAsync (job_t *job, fun_t *fun)
 Async alias of job_send().
void job_push (job_t *job, fun_t *fun)
 transfer job data to the job queue object, remove the oldest job data if the job queue object is full
unsigned job_count (job_t *job)
 return the amount of data contained in the job queue
unsigned job_space (job_t *job)
 return the amount of free space in the job queue
unsigned job_limit (job_t *job)
 return the size of the job queue

Detailed Description

job queues (procedures executed by the receiving task)

Macro Definition Documentation

◆ OS_JOB_BUFFER

#define OS_JOB_BUFFER ( buf,
size )
Value:
fun_t *buf[size]
void fun_t(void)
timer/task procedure
Definition osbase.h:142

define job queue data buffer

Parameters
bufname of the buffer (passed to the init function)
sizesize of a queue (max number of stored job procedures)

◆ OS_JOB

#define OS_JOB ( job,
limit )
Value:
static fun_t *job##__buf[limit]; \
job_t job[] = { _JOB_INIT( limit, job##__buf ) }

define and initialize a job queue object

Parameters
jobname of a pointer to job queue object
limitsize of a queue (max number of stored job procedures)

◆ static_JOB

#define static_JOB ( job,
limit )
Value:
static fun_t *job##__buf[limit]; \
static job_t job[] = { _JOB_INIT( limit, job##__buf ) }

static alias of OS_JOB()

◆ JOB_INIT

#define JOB_INIT ( limit)
Value:
_JOB_INIT( limit, _JOB_DATA( limit ) )

create and initialize a job queue object

Parameters
limitsize of a queue (max number of stored job procedures)
Returns
job queue object
Note
use only in 'C' code

◆ JOB_CREATE

#define JOB_CREATE ( limit)
Value:
{ JOB_INIT ( limit ) }
#define JOB_INIT(limit)
create and initialize a job queue object
Definition osjobqueue.h:137

create and initialize a job queue object

Parameters
limitsize of a queue (max number of stored job procedures)
Returns
job queue object as array (id)
Note
use only in 'C' code

Function Documentation

◆ job_init()

void job_init ( job_t * job,
fun_t ** data,
size_t bufsize )

initialize a job queue object

Parameters
jobpointer to job queue object
datajob queue data buffer
bufsizesize of the data buffer (in bytes)

◆ job_reset()

void job_reset ( job_t * job)

reset the job queue object and wake up all waiting tasks with 'E_STOPPED' event

Parameters
jobpointer to job queue object
Note
use only in thread mode

◆ job_take()

int job_take ( job_t * job)

try to transfer job data from the job queue object and execute the job procedure, don't wait if the job queue object is empty

Parameters
jobpointer to job queue object
Return values
E_SUCCESSjob data was successfully transferred from the job queue object
E_TIMEOUTjob queue object is empty, try again
Note
use Async alias for communication with unmasked interrupt handlers

◆ job_waitFor()

int job_waitFor ( job_t * job,
cnt_t delay )

try to transfer job data from the job queue object and execute the job procedure, wait for given duration of time while the job queue object is empty

Parameters
jobpointer to job queue object
delayduration of time (maximum number of ticks to wait while the job queue object is empty)
  • IMMEDIATE: don't wait if the job queue object is empty
  • INFINITE: wait indefinitely while the job queue object is empty
Return values
E_SUCCESSjob data was successfully transferred from the job queue object
E_STOPPEDjob queue object was reseted before the specified timeout expired
E_TIMEOUTjob queue object is empty and was not received data before the specified timeout expired

◆ job_waitUntil()

int job_waitUntil ( job_t * job,
cnt_t time )

try to transfer job data from the job queue object and execute the job procedure, wait until given timepoint while the job queue object is empty

Parameters
jobpointer to job queue object
timetimepoint value
Return values
E_SUCCESSjob data was successfully transferred from the job queue object
E_STOPPEDjob queue object was reseted before the specified timeout expired
E_TIMEOUTjob queue object is empty and was not received data before the specified timeout expired

◆ job_wait()

int job_wait ( job_t * job)
inline

try to transfer job data from the job queue object and execute the job procedure, wait indefinitely while the job queue object is empty

Parameters
jobpointer to job queue object
Return values
E_SUCCESSjob data was successfully transferred from the job queue object
E_STOPPEDjob queue object was reseted (unavailable for async version)
Note
use Async alias for communication with unmasked interrupt handlers

◆ job_give()

int job_give ( job_t * job,
fun_t * fun )

try to transfer job data to the job queue object, don't wait if the job queue object is full

Parameters
jobpointer to job queue object
funpointer to job procedure
Return values
E_SUCCESSjob data was successfully transferred to the job queue object
E_TIMEOUTjob queue object is full, try again
Note
use Async alias for communication with unmasked interrupt handlers

◆ job_sendFor()

int job_sendFor ( job_t * job,
fun_t * fun,
cnt_t delay )

try to transfer job data to the job queue object, wait for given duration of time while the job queue object is full

Parameters
jobpointer to job queue object
funpointer to job procedure
delayduration of time (maximum number of ticks to wait while the job queue object is full)
  • IMMEDIATE: don't wait if the job queue object is full
  • INFINITE: wait indefinitely while the job queue object is full
Return values
E_SUCCESSjob data was successfully transferred to the job queue object
E_STOPPEDjob queue object was reseted before the specified timeout expired
E_TIMEOUTjob queue object is full and was not issued data before the specified timeout expired

◆ job_sendUntil()

int job_sendUntil ( job_t * job,
fun_t * fun,
cnt_t time )

try to transfer job data to the job queue object, wait until given timepoint while the job queue object is full

Parameters
jobpointer to job queue object
funpointer to job procedure
timetimepoint value
Return values
E_SUCCESSjob data was successfully transferred to the job queue object
E_STOPPEDjob queue object was reseted before the specified timeout expired
E_TIMEOUTjob queue object is full and was not issued data before the specified timeout expired

◆ job_send()

int job_send ( job_t * job,
fun_t * fun )
inline

try to transfer job data to the job queue object, wait indefinitely while the job queue object is full

Parameters
jobpointer to job queue object
funpointer to job procedure
Return values
E_SUCCESSjob data was successfully transferred to the job queue object
E_STOPPEDjob queue object was reseted (unavailable for async version)
Note
use Async alias for communication with unmasked interrupt handlers

◆ job_push()

void job_push ( job_t * job,
fun_t * fun )

transfer job data to the job queue object, remove the oldest job data if the job queue object is full

Parameters
jobpointer to job queue object
funpointer to job procedure

◆ job_count()

unsigned job_count ( job_t * job)

return the amount of data contained in the job queue

Parameters
jobpointer to job queue object
Returns
amount of data contained in the job queue

◆ job_space()

unsigned job_space ( job_t * job)

return the amount of free space in the job queue

Parameters
jobpointer to job queue object
Returns
amount of free space in the job queue

◆ job_limit()

unsigned job_limit ( job_t * job)

return the size of the job queue

Parameters
jobpointer to job queue object
Returns
size of the job queue