1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-30 08:51:19 +01:00
Marian Buschsieweke adf423e1ed
tests/sys/event_thread_shared: fix on native
On native the stack size needs to be a bit larger than on MCUs to not
run into a stack overflow.
2025-12-15 22:44:08 +01:00

69 lines
1.5 KiB
C

/*
* SPDX-FileCopyrightText: 2020 Kaspar Schleiser <kaspar@schleiser.de>
* SPDX-FileCopyrightText: 2020 Freie Universität Berlin
* SPDX-FileCopyrightText: 2020 Inria
* SPDX-License-Identifier: LGPL-2.1-only
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Event threads test application
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
*
* @}
*/
#include <assert.h>
#include <stdio.h>
#include "thread.h"
#include "event/thread.h"
#if defined(BOARD_NATIVE64) || defined(BOARD_NATIVE32)
# define STACKSIZE_EXPECTED 4096
#else
# define STACKSIZE_EXPECTED 567
#endif
static_assert(EVENT_THREAD_MEDIUM_STACKSIZE == STACKSIZE_EXPECTED,
"Selecting highest of the minimum stack size requirements "
"declared via `EVENT_THREAD_HIGHEST_STACKSIZE_MIN += <num>` "
"must work correctly");
static void _handler_high(event_t *event) {
(void)event;
puts("high");
}
static event_t event_high = { .handler=_handler_high };
static void _handler_medium(event_t *event) {
(void)event;
event_post(EVENT_PRIO_HIGHEST, &event_high);
puts("medium");
}
static event_t event_medium = { .handler=_handler_medium };
static void _handler_low(event_t *event) {
(void)event;
event_post(EVENT_PRIO_MEDIUM, &event_medium);
event_post(EVENT_PRIO_HIGHEST, &event_high);
puts("low");
}
static event_t event_low = { .handler=_handler_low };
int main(void)
{
event_post(EVENT_PRIO_LOWEST, &event_low);
puts("main done");
return 0;
}