diff --git a/src/app/server/java/ChipThreadWork.cpp b/src/app/server/java/ChipThreadWork.cpp index 334e3052211e42..c95fd647ee1de4 100644 --- a/src/app/server/java/ChipThreadWork.cpp +++ b/src/app/server/java/ChipThreadWork.cpp @@ -17,7 +17,9 @@ #include "ChipThreadWork.h" #include -#include + +#include +#include namespace chip { namespace ThreadWork { @@ -26,12 +28,21 @@ namespace { struct WorkData { WorkCallback callback; - sem_t done; + std::mutex mux; + std::condition_variable cond; + bool done = false; - WorkData() { sem_init(&done, 0 /* shared */, 0); } - ~WorkData() { sem_destroy(&done); } - void Post() { sem_post(&done); } - void Wait() { sem_wait(&done); } + void Post() + { + std::unique_lock lock(mux); + done = true; + cond.notify_all(); + } + void Wait() + { + std::unique_lock lock(mux); + cond.wait(lock, [&] { return done; }); + } }; void PerformWork(intptr_t arg) diff --git a/src/controller/python/chip/native/ChipMainLoopWork_WorkSchedule.cpp b/src/controller/python/chip/native/ChipMainLoopWork_WorkSchedule.cpp index fec65a150c9396..7abf1d9f81a92c 100644 --- a/src/controller/python/chip/native/ChipMainLoopWork_WorkSchedule.cpp +++ b/src/controller/python/chip/native/ChipMainLoopWork_WorkSchedule.cpp @@ -17,8 +17,9 @@ */ #include "ChipMainLoopWork.h" +#include +#include #include -#include namespace chip { namespace MainLoopWork { @@ -27,12 +28,21 @@ namespace { struct WorkData { std::function callback; - sem_t done; + std::mutex mux; + std::condition_variable cond; + bool done = false; - WorkData() { sem_init(&done, 0 /* shared */, 0); } - ~WorkData() { sem_destroy(&done); } - void Post() { sem_post(&done); } - void Wait() { sem_wait(&done); } + void Post() + { + std::unique_lock lock(mux); + done = true; + cond.notify_all(); + } + void Wait() + { + std::unique_lock lock(mux); + cond.wait(lock, [&] { return done; }); + } }; void PerformWork(intptr_t arg) diff --git a/third_party/imgui/repo b/third_party/imgui/repo index 454f36d2af9d92..1ab63d925f21e0 160000 --- a/third_party/imgui/repo +++ b/third_party/imgui/repo @@ -1 +1 @@ -Subproject commit 454f36d2af9d92a0f8ffe8536c218247df732edc +Subproject commit 1ab63d925f21e03be7735661500e5b914dd93c19 diff --git a/third_party/mbedtls/repo b/third_party/mbedtls/repo index e44be6a7d3d31f..d6d43ec8a59f5f 160000 --- a/third_party/mbedtls/repo +++ b/third_party/mbedtls/repo @@ -1 +1 @@ -Subproject commit e44be6a7d3d31f3fac1a74b262b395984d193b05 +Subproject commit d6d43ec8a59f5f5dc1a2138fe57dacea31736e94 diff --git a/third_party/nanopb/repo b/third_party/nanopb/repo index 9aa922d9dbaf14..9766c4589f61b7 160000 --- a/third_party/nanopb/repo +++ b/third_party/nanopb/repo @@ -1 +1 @@ -Subproject commit 9aa922d9dbaf147b07cc0fdb2392a9995c4e95db +Subproject commit 9766c4589f61b76807a0a394040c15a2d23ef24c diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 5eccd87a773568..90d97fa3b4292c 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 5eccd87a773568f5db5f5e7f1dd0809860f3d01e +Subproject commit 90d97fa3b4292c39074e6f2b94dbd1cffa6ee318