Skip to content

Conversation

@pdgendt
Copy link
Contributor

@pdgendt pdgendt commented Sep 20, 2022

This commit introduces a zephyr thread for SDL events. This allows to use zephyr mutex locking with SDL callbacks.

Relates to #50080; as this calls gpio_emul_input_set which locks a mutex, and asserts if called from an idle thread (which apparently is the case for the posix main thread).

@zephyrbot zephyrbot added the area: native port Host native arch port (native_sim) label Sep 20, 2022
@aescolar
Copy link
Member

aescolar commented Sep 20, 2022

(which apparently is the case for the posix main thread).

Just for info: The native_posix main thread is a separate thread than the Zephyr SW threads. If you call Zephyr APIs from it, you confuse the Zephyr kernel :)

@pdgendt
Copy link
Contributor Author

pdgendt commented Sep 20, 2022

If you call Zephyr APIs from it, you confuse the Zephyr kernel :)

That is exactly the problem :)

@pdgendt pdgendt force-pushed the native-posix-sdl-thread branch from d535cc2 to 48e312b Compare September 20, 2022 09:26
@pdgendt pdgendt requested a review from aescolar September 20, 2022 09:26
Copy link
Member

@aescolar aescolar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can still define a kconfig option for the delay :), just not a too tiny amount

This commit introduces a zephyr thread for SDL events. This allows
to use zephyr mutex locking with SDL callbacks.

Signed-off-by: Pieter De Gendt <[email protected]>
@pdgendt pdgendt force-pushed the native-posix-sdl-thread branch from 48e312b to 17c7089 Compare September 20, 2022 09:35
@pdgendt pdgendt requested a review from aescolar September 20, 2022 09:36
@pdgendt
Copy link
Contributor Author

pdgendt commented Sep 20, 2022

@aescolar FYI when enabling CONFIG_STACK_SENTINEL the CONFIG_ARCH_POSIX_RECOMMENDED_STACK_SIZE should be set to 44 instead of 40 in case of 64 bit, to prevent a stack overflow. Not sure for 32 bit though.

@aescolar
Copy link
Member

aescolar commented Sep 20, 2022

@aescolar FYI when enabling CONFIG_STACK_SENTINEL the CONFIG_ARCH_POSIX_RECOMMENDED_STACK_SIZE should be set to 44 instead of 40 in case of 64 bit, to prevent a stack overflow. Not sure for 32 bit though.

Would you so kind as to send a PR to fix it?

@pdgendt
Copy link
Contributor Author

pdgendt commented Sep 20, 2022

Would you so kind as to send a PR to fix it?

Done #50416

@carlescufi carlescufi merged commit 1b40a17 into zephyrproject-rtos:main Oct 5, 2022
@pdgendt pdgendt deleted the native-posix-sdl-thread branch October 5, 2022 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native port Host native arch port (native_sim)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants