2017-10-22 13:54:43 +02:00
|
|
|
/*
|
2019-05-02 11:22:56 +02:00
|
|
|
* Copyright (C) 2017 Inria
|
|
|
|
* 2017 Freie Universität Berlin
|
|
|
|
* 2017 Kaspar Schleiser <kaspar@schleiser.de>
|
2017-10-22 13:54:43 +02:00
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "event/callback.h"
|
|
|
|
|
|
|
|
void _event_callback_handler(event_t *event)
|
|
|
|
{
|
|
|
|
event_callback_t *event_callback = (event_callback_t *) event;
|
|
|
|
event_callback->callback(event_callback->arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void event_callback_init(event_callback_t *event_callback, void (callback)(void *), void *arg)
|
|
|
|
{
|
2022-02-08 15:52:15 +01:00
|
|
|
memset(event_callback, 0, sizeof(*event_callback));
|
2017-10-22 13:54:43 +02:00
|
|
|
event_callback->super.handler = _event_callback_handler;
|
|
|
|
event_callback->callback = callback;
|
|
|
|
event_callback->arg = arg;
|
|
|
|
}
|