48typedef struct __box box_t;
63typedef struct __box box_id [];
82#define _BOX_INIT( _limit, _size, _data ) { _OBJ_INIT(), 0, _limit * _size, _size, 0, 0, _data }
101#define _BOX_DATA( _limit, _size ) (char[_limit * _size]){ 0 }
112#define OS_BOX_BUFFER( buf, limit, size ) \
113 char buf[limit * size]
123#define OS_BOX( box, limit, size ) \
124 static char box##__buf[limit * size]; \
125 box_t box[] = { _BOX_INIT( limit, size, box##__buf ) }
128#define static_BOX( box, limit, size ) \
129 static char box##__buf[limit * size]; \
130 static box_t box[] = { _BOX_INIT( limit, size, box##__buf ) }
144#define BOX_INIT( limit, size ) \
145 _BOX_INIT( limit, size, _BOX_DATA( limit, size ) )
160#define BOX_CREATE( limit, size ) \
161 { BOX_INIT ( limit, size ) }
180void box_init( box_t *box,
size_t size,
void *
data,
size_t bufsize );
395size_t box_size( box_t *box ) {
return box->size; }
403#if defined(__cplusplus)
414template<
unsigned limit_,
size_t size_>
426 assert(_src.__box::count == 0 && _src.obj.queue ==
nullptr);
443 int give (
const void *_data ) {
return box_give (
this, _data); }
462 char data_[limit_ * size_];
473template<
unsigned limit_,
class C>
#define INFINITE
infinite waiting
Definition osbase.h:250
int box_giveAsync(box_t *box, const void *data)
Async alias of box_give().
int box_take(box_t *box, void *data)
try to transfer mailbox data from the mailbox queue object, don't wait if the mailbox queue object is...
void box_kill(box_t *box)
alias of box_reset()
Definition osmailboxqueue.h:193
int box_send(box_t *box, const void *data)
try to transfer mailbox data to the mailbox queue object, wait indefinitely while the mailbox queue o...
Definition osmailboxqueue.h:338
size_t box_size(box_t *box)
return size of a single mail
Definition osmailboxqueue.h:394
unsigned box_limit(box_t *box)
return the size of the mailbox queue
int box_takeAsync(box_t *box, void *data)
Async alias of box_take().
int box_sendFor(box_t *box, const void *data, cnt_t delay)
try to transfer mailbox data to the mailbox queue object, wait for given duration of time while the m...
unsigned box_count(box_t *box)
return the amount of data contained in the mailbox queue
void box_init(box_t *box, size_t size, void *data, size_t bufsize)
initialize a mailbox queue object
int box_sendUntil(box_t *box, const void *data, cnt_t time)
try to transfer mailbox data to the mailbox queue object, wait until given timepoint while the mailbo...
int box_tryWait(box_t *box, void *data)
alias of box_take()
Definition osmailboxqueue.h:212
int box_give(box_t *box, const void *data)
try to transfer mailbox data to the mailbox queue object, don't wait if the mailbox queue object is f...
int box_wait(box_t *box, void *data)
try to transfer mailbox data from the mailbox queue object, wait indefinitely while the mailbox queue...
Definition osmailboxqueue.h:265
unsigned box_space(box_t *box)
return the amount of free space in the mailbox queue
void box_push(box_t *box, const void *data)
transfer mailbox data to the mailbox queue object, remove the oldest mailbox data if the mailbox queu...
int box_waitUntil(box_t *box, void *data, cnt_t time)
try to transfer mailbox data from the mailbox queue object, wait until given timepoint while the mail...
int box_sendAsync(box_t *box, const void *data)
Async alias of box_send().
void box_reset(box_t *box)
reset the mailbox queue object and wake up all waiting tasks with 'E_STOPPED' event value
int box_waitFor(box_t *box, void *data, cnt_t delay)
try to transfer mailbox data from the mailbox queue object, wait for given duration of time while the...
int box_waitAsync(box_t *box, void *data)
Async alias of box_wait().
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
constexpr MailBoxQueueTT()
constructor, see the constructor parameters of the class
Definition osmailboxqueue.h:477
create and initialize a mailbox queue object
Definition osmailboxqueue.h:415
int sendUntil(const void *_data, const T &_time)
box_sendUntil()
Definition osmailboxqueue.h:446
int wait(void *_data)
box_wait()
Definition osmailboxqueue.h:441
int give(const void *_data)
box_give()
Definition osmailboxqueue.h:442
unsigned space()
box_space()
Definition osmailboxqueue.h:450
int waitFor(void *_data, const T &_delay)
box_waitFor()
Definition osmailboxqueue.h:438
void kill()
box_kill()
Definition osmailboxqueue.h:434
void reset()
box_reset()
Definition osmailboxqueue.h:433
constexpr MailBoxQueueT()
constructor, see the constructor parameters of the class
Definition osmailboxqueue.h:418
int take(void *_data)
box_take()
Definition osmailboxqueue.h:435
int waitAsync(void *_data)
box_waitAsync()
Definition osmailboxqueue.h:455
void push(const void *_data)
box_push()
Definition osmailboxqueue.h:448
int send(const void *_data)
box_send()
Definition osmailboxqueue.h:447
unsigned limit()
box_limit()
Definition osmailboxqueue.h:451
int takeAsync(void *_data)
box_takeAsync()
Definition osmailboxqueue.h:454
unsigned count()
box_count()
Definition osmailboxqueue.h:449
int giveAsync(const void *_data)
box_giveAsync()
Definition osmailboxqueue.h:456
int tryWait(void *_data)
box_tryWait()
Definition osmailboxqueue.h:436
size_t size()
box_size()
Definition osmailboxqueue.h:452
int sendAsync(const void *_data)
box_sendAsync()
Definition osmailboxqueue.h:457
int sendFor(const void *_data, const T &_delay)
box_sendFor()
Definition osmailboxqueue.h:444
int waitUntil(void *_data, const T &_time)
box_waitUntil()
Definition osmailboxqueue.h:440