Skip to content

Commit

Permalink
core: proto: Yield thread after put a data on pipe
Browse files Browse the repository at this point in the history
Yield the thread right after putting data on the pipe or when the
device is not connected. This way, the net_thread can start handling
the data.

Signed-off-by: Allysson Lukas <[email protected]>
  • Loading branch information
alla3 authored and vitbaq committed Nov 8, 2019
1 parent cef815f commit 86608ab
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions core/src/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ static void proto_thread(void)
/* Calling KNoT app: loop() */
loop();

peripheral_flag_status();

/* Handle reset flag */
reset = peripheral_get_reset();
if (reset) {
/* TODO: Unregister before reseting */
LOG_INF("Reseting system...");
#if !CONFIG_BOARD_QEMU_X86
clear_factory();
sys_reboot(SYS_REBOOT_WARM);
#endif
}

/* Ignore net and SM if disconnected */
if (check_connection() == false) {
peripheral_set_status_period(STATUS_DISCONN_PERIOD);
Expand All @@ -109,19 +122,6 @@ static void proto_thread(void)
&olen, olen, K_NO_WAIT);

done:
peripheral_flag_status();

/* Handle reset flag */
reset = peripheral_get_reset();
if (reset) {
/* TODO: Unregister before reseting */
LOG_INF("Reseting system...");
#if !CONFIG_BOARD_QEMU_X86
clear_factory();
sys_reboot(SYS_REBOOT_WARM);
#endif
}

k_yield();
}

Expand Down

0 comments on commit 86608ab

Please sign in to comment.