From 427079765a08466ccc0a77e84edf2b2f097ca125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Wed, 30 Jun 2021 20:38:54 +0200 Subject: [PATCH] [nrfconnect] Stop using cooperative threads (#8025) nRF Connect platform used cooperative threads, that is threads that cannot be preempted, to workaround some synchronization issues in the past, but it's no longer needed and is risky. The latter was revealed by #7927, which caused that `select()` never waits (needs to be fixed in another PR). Signed-off-by: Damian Krolik --- examples/lighting-app/nrfconnect/main/main.cpp | 2 -- examples/lighting-app/telink/src/main.cpp | 2 -- examples/lock-app/nrfconnect/main/main.cpp | 2 -- examples/pump-app/nrfconnect/main/main.cpp | 2 -- examples/pump-controller-app/nrfconnect/main/main.cpp | 2 -- src/platform/nrfconnect/CHIPDevicePlatformConfig.h | 2 +- 6 files changed, 1 insertion(+), 11 deletions(-) diff --git a/examples/lighting-app/nrfconnect/main/main.cpp b/examples/lighting-app/nrfconnect/main/main.cpp index 270ba58da31f42..beb05be8368814 100644 --- a/examples/lighting-app/nrfconnect/main/main.cpp +++ b/examples/lighting-app/nrfconnect/main/main.cpp @@ -38,8 +38,6 @@ int main(void) int ret = 0; - k_thread_priority_set(k_current_get(), K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)); - ret = chip::Platform::MemoryInit(); if (ret != CHIP_NO_ERROR) { diff --git a/examples/lighting-app/telink/src/main.cpp b/examples/lighting-app/telink/src/main.cpp index 6e061f4411c5c3..d2c4d35c38be17 100644 --- a/examples/lighting-app/telink/src/main.cpp +++ b/examples/lighting-app/telink/src/main.cpp @@ -33,8 +33,6 @@ int main(void) { int ret = 0; - k_thread_priority_set(k_current_get(), K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)); - ret = chip::Platform::MemoryInit(); if (ret != CHIP_NO_ERROR) { diff --git a/examples/lock-app/nrfconnect/main/main.cpp b/examples/lock-app/nrfconnect/main/main.cpp index f144f1bd13e878..5902f9f0e4dee1 100644 --- a/examples/lock-app/nrfconnect/main/main.cpp +++ b/examples/lock-app/nrfconnect/main/main.cpp @@ -34,8 +34,6 @@ int main() { int ret = 0; - k_thread_priority_set(k_current_get(), K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)); - ret = chip::Platform::MemoryInit(); if (ret != CHIP_NO_ERROR) { diff --git a/examples/pump-app/nrfconnect/main/main.cpp b/examples/pump-app/nrfconnect/main/main.cpp index f144f1bd13e878..5902f9f0e4dee1 100644 --- a/examples/pump-app/nrfconnect/main/main.cpp +++ b/examples/pump-app/nrfconnect/main/main.cpp @@ -34,8 +34,6 @@ int main() { int ret = 0; - k_thread_priority_set(k_current_get(), K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)); - ret = chip::Platform::MemoryInit(); if (ret != CHIP_NO_ERROR) { diff --git a/examples/pump-controller-app/nrfconnect/main/main.cpp b/examples/pump-controller-app/nrfconnect/main/main.cpp index f144f1bd13e878..5902f9f0e4dee1 100644 --- a/examples/pump-controller-app/nrfconnect/main/main.cpp +++ b/examples/pump-controller-app/nrfconnect/main/main.cpp @@ -34,8 +34,6 @@ int main() { int ret = 0; - k_thread_priority_set(k_current_get(), K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)); - ret = chip::Platform::MemoryInit(); if (ret != CHIP_NO_ERROR) { diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index 1ac66e312c8056..346638d38b98fd 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -50,7 +50,7 @@ // ========== Platform-specific Configuration Overrides ========= #ifndef CHIP_DEVICE_CONFIG_CHIP_TASK_PRIORITY -#define CHIP_DEVICE_CONFIG_CHIP_TASK_PRIORITY (K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)) +#define CHIP_DEVICE_CONFIG_CHIP_TASK_PRIORITY (K_PRIO_PREEMPT(1)) #endif // CHIP_DEVICE_CONFIG_CHIP_TASK_PRIORITY #ifndef CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE