zephyr/subsys/shell
Jakub Rzeszutko 46a02322ec shell: allow commands to suspend shell thread
It was possible to deadlock the shell when command
suspended shell's thread and next another thread wanted
to print something on the shell.

To avoid that shell releases mutex before entering command
handler. Due to this change some  adapations to shell
internal print functions have been applied.

This change addresses following usecase:
1. A command handler needs to call a (system) function which
communicate results via a callback, and this callback is expected
to print these results. The callback is called by the system from
another thread.
2. To achieve that, the handler needs to pass `struct shell *`
to callbacks, but also some other data specific to callback.
Thus, handles allocates some structure will those fields on
the stack.
3. The handler schedules this callback to be called.
4. As a reference to stack structure is passed to the callback,
the handler can't return immediately (or stack data will go out
of scope and will be overwritten).
5. So, the handler blocks waiting for callback to finish.

Previously, this scenario led to deadlock when the callback
trying or print to shell. With these changes, it just works,
as long as main handler and callback serialize there access
to the shell structure (i.e. when callback prints, the main
handler is blocked waiting for its completion).

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2019-02-14 13:40:28 +01:00
..
modules
CMakeLists.txt
Kconfig shell: improved shell_prompt_change function 2019-02-08 14:51:52 -05:00
Kconfig.backends dts: Convert CONFIG_ to DT_ symbols for chosen props 2019-02-08 11:41:26 -06:00
Kconfig.template.shell_log_queue_size
Kconfig.template.shell_log_queue_timeout
shell.c shell: allow commands to suspend shell thread 2019-02-14 13:40:28 +01:00
shell_cmds.c
shell_dummy.c
shell_fprintf.c
shell_help.c shell: allow commands to suspend shell thread 2019-02-14 13:40:28 +01:00
shell_help.h
shell_history.c shell: Allocate proper amount of history slab memory 2019-02-06 07:16:08 -05:00
shell_log_backend.c
shell_ops.c shell: allow commands to suspend shell thread 2019-02-14 13:40:28 +01:00
shell_ops.h shell: allow commands to suspend shell thread 2019-02-14 13:40:28 +01:00
shell_rtt.c shell: Add support to log_panic in RTT backend 2019-02-13 17:25:59 -05:00
shell_uart.c
shell_utils.c shell: unify commands execution 2019-02-08 14:58:44 -05:00
shell_utils.h shell: unify commands execution 2019-02-08 14:58:44 -05:00
shell_vt100.h
shell_wildcard.c shell: allow commands to suspend shell thread 2019-02-14 13:40:28 +01:00
shell_wildcard.h