48typedef struct __job job_t;
62typedef struct __job job_id [];
80#define _JOB_INIT( _limit, _data ) { _OBJ_INIT(), 0, _limit, 0, 0, _data }
98#define _JOB_DATA( _limit ) (fun_t *[_limit]){ NULL }
108#define OS_JOB_BUFFER( buf, size ) \
118#define OS_JOB( job, limit ) \
119 static fun_t *job##__buf[limit]; \
120 job_t job[] = { _JOB_INIT( limit, job##__buf ) }
123#define static_JOB( job, limit ) \
124 static fun_t *job##__buf[limit]; \
125 static job_t job[] = { _JOB_INIT( limit, job##__buf ) }
138#define JOB_INIT( limit ) \
139 _JOB_INIT( limit, _JOB_DATA( limit ) )
153#define JOB_CREATE( limit ) \
154 { JOB_INIT ( limit ) }
380#if defined(__cplusplus)
390template<
unsigned limit_>
395 JobQueueT(): __job _JOB_INIT(limit_, data_) {}
397 ~JobQueueT() { assert(__job::obj.queue ==
nullptr); }
402 assert(_src.__job::count == 0 && _src.obj.queue ==
nullptr);
437 fun_t *data_[limit_];
#define INFINITE
infinite waiting
Definition osbase.h:250
void fun_t(void)
timer/task procedure
Definition osbase.h:142
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...
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 ti...
int job_tryWait(job_t *job)
alias of job_take()
Definition osjobqueue.h:203
unsigned job_count(job_t *job)
return the amount of data contained in the job queue
int job_wait(job_t *job)
try to transfer job data from the job queue object and execute the job procedure, wait indefinitely w...
Definition osjobqueue.h:253
int job_takeAsync(job_t *job)
Async alias of job_take().
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
void job_kill(job_t *job)
alias of job_reset()
Definition osjobqueue.h:185
int job_giveAsync(job_t *job, fun_t *fun)
Async alias of job_give().
void job_init(job_t *job, fun_t **data, size_t bufsize)
initialize a job queue object
unsigned job_limit(job_t *job)
return the size of the job queue
unsigned job_space(job_t *job)
return the amount of free space in the job queue
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_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 dura...
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 j...
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 ful...
Definition osjobqueue.h:326
void job_reset(job_t *job)
reset the job queue object and wake up all waiting tasks with 'E_STOPPED' event
int job_waitAsync(job_t *job)
Async alias of job_wait().
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 obje...
char data[]
message data
Definition osmessagequeue.h:54
static constexpr rep until(const std::chrono::time_point< Clock, _Duration > &_time)
time point in ticks, rounded up to whole ticks (only a time point of this clock)
Definition osclock.h:109
static constexpr rep count(const std::chrono::duration< _Rep, _Period > &_delay)
delay in ticks, rounded up to whole ticks; negative delay: IMMEDIATE, delay out of range: INFINITE
Definition osclock.h:102
create and initialize a job queue object
Definition osjobqueue.h:391
void kill()
job_kill()
Definition osjobqueue.h:410
int waitFor(const T &_delay)
job_waitFor()
Definition osjobqueue.h:414
constexpr JobQueueT()
constructor, see the constructor parameters of the class
Definition osjobqueue.h:394
int sendUntil(fun_t *_fun, const T &_time)
job_sendUntil()
Definition osjobqueue.h:422
int give(fun_t *_fun)
job_give()
Definition osjobqueue.h:418
int send(fun_t *_fun)
job_send()
Definition osjobqueue.h:423
int wait()
job_wait()
Definition osjobqueue.h:417
void push(fun_t *_fun)
job_push()
Definition osjobqueue.h:424
int tryWait()
job_tryWait()
Definition osjobqueue.h:412
unsigned limit()
job_limit()
Definition osjobqueue.h:427
int sendAsync(fun_t *_fun)
job_sendAsync()
Definition osjobqueue.h:432
void reset()
job_reset()
Definition osjobqueue.h:409
unsigned space()
job_space()
Definition osjobqueue.h:426
int sendFor(fun_t *_fun, const T &_delay)
job_sendFor()
Definition osjobqueue.h:420
int waitUntil(const T &_time)
job_waitUntil()
Definition osjobqueue.h:416
int take()
job_take()
Definition osjobqueue.h:411
unsigned count()
job_count()
Definition osjobqueue.h:425
int waitAsync()
job_waitAsync()
Definition osjobqueue.h:430
int takeAsync()
job_takeAsync()
Definition osjobqueue.h:429
int giveAsync(fun_t *_fun)
job_giveAsync()
Definition osjobqueue.h:431