Loading...
Searching...
No Matches
evtimer_mbox.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Simon Brummer <simon.brummer@posteo.de>
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
18#ifndef EVTIMER_MBOX_H
19#define EVTIMER_MBOX_H
20
21#include "assert.h"
22#include "msg.h"
23#include "mbox.h"
24#include "evtimer.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
38
50static inline void evtimer_add_mbox(evtimer_t *evtimer, evtimer_mbox_event_t *event, mbox_t *mbox)
51{
52 assert(evtimer);
54 assert(mbox);
55 event->mbox = mbox;
56 evtimer_add(evtimer, &(event->event));
57}
58
67{
70 mbox_try_put(mbevent->mbox, &(mbevent->msg));
71}
72
80static inline void evtimer_init_mbox(evtimer_t *evtimer)
81{
82 assert(evtimer);
84}
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif /* EVTIMER_MBOX_H */
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:136
evtimer API definitions
static int mbox_try_put(mbox_t *mbox, msg_t *msg)
Add message to mailbox.
Definition mbox.h:127
void evtimer_init(evtimer_t *evtimer, evtimer_callback_t handler)
Initializes an event timer.
static void _evtimer_mbox_handler(evtimer_event_t *event)
Event handler for mbox events.
static void evtimer_init_mbox(evtimer_t *evtimer)
Initializes event timer for mbox events.
static void evtimer_add_mbox(evtimer_t *evtimer, evtimer_mbox_event_t *event, mbox_t *mbox)
Adds mbox event to an event timer.
void evtimer_add(evtimer_t *evtimer, evtimer_event_t *event)
Adds event to an event timer.
Mailbox API.
event structure
Definition event.h:148
Generic event.
Definition evtimer.h:56
Message box event definition.
msg_t msg
message to store in mbox on event
evtimer_event_t event
event base class
mbox_t * mbox
mbox the IPC message shall be stored
Event timer.
Definition evtimer.h:69
Mailbox struct definition.
Definition mbox.h:41
Describes a message object which can be sent between threads.
Definition msg.h:196