From 60b92eb0b25cc5b3ad70b4379f8558df6a35f569 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Thu, 13 Jun 2019 16:52:23 +0200 Subject: [PATCH] porting: Fix some oddities in linux examples --- porting/examples/linux/main.c | 10 +++------- porting/examples/linux_blemesh/ble.c | 1 + porting/examples/linux_blemesh/main.c | 12 ++++-------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/porting/examples/linux/main.c b/porting/examples/linux/main.c index 7d9487081..7f39d6589 100644 --- a/porting/examples/linux/main.c +++ b/porting/examples/linux/main.c @@ -56,6 +56,8 @@ void *ble_host_task(void *param) int main(void) { + int ret = 0; + ble_hci_sock_init(); nimble_port_init(); @@ -79,11 +81,5 @@ int main(void) NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_WAIT_FOREVER, TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE); - int ret = 0; - pthread_exit(&ret); - - while (true) - { - pthread_yield(); - } + pthread_exit(&ret); } diff --git a/porting/examples/linux_blemesh/ble.c b/porting/examples/linux_blemesh/ble.c index 28caa8d1b..22a9e71d5 100644 --- a/porting/examples/linux_blemesh/ble.c +++ b/porting/examples/linux_blemesh/ble.c @@ -22,6 +22,7 @@ #include "console/console.h" /* BLE */ +#include "nimble/nimble_port.h" #include "nimble/ble.h" #include "host/ble_hs.h" #include "services/gap/ble_svc_gap.h" diff --git a/porting/examples/linux_blemesh/main.c b/porting/examples/linux_blemesh/main.c index c40da494e..aaa842f32 100644 --- a/porting/examples/linux_blemesh/main.c +++ b/porting/examples/linux_blemesh/main.c @@ -23,8 +23,8 @@ #include #include "nimble/nimble_npl.h" #include "nimble/nimble_port.h" -#include "nimble/nimble_port.h" +#include "mesh/glue.h" #include "mesh/porting.h" #include "services/gap/ble_svc_gap.h" @@ -62,13 +62,15 @@ void *ble_mesh_adv_task(void *param) void mesh_initialized(void) { - ble_npl_task_init(&s_task_host, "ble_mesh_adv", ble_mesh_adv_task, + ble_npl_task_init(&s_task_mesh_adv, "ble_mesh_adv", ble_mesh_adv_task, NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_WAIT_FOREVER, TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE); } int main(void) { + int ret = 0; + ble_hci_sock_init(); nimble_port_init(); @@ -88,11 +90,5 @@ int main(void) NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_WAIT_FOREVER, TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE); - int ret = 0; pthread_exit(&ret); - - while (true) - { - pthread_yield(); - } }