pw_thread_freertos: Fix extra wakeups when detaching threads

vTaskResume() is known to cause premature return from blocking APIs,
since it will indiscriminately call prvAddTaskToReadyList().

Instead, use vTaskSuspendAll() / xTaskResumeAll(), which will not wake
up any tasks which weren't already running (and weren't signalled during
scheduler suspension).

This also fixes a latent bug where, in the existing fallback case of
using vTaskSuspendAll(), the new task scheduler state will be
taskSCHEDULER_SUSPENDED, causing the subsequent xTaskResumeAll() to be
skipped.

Bug: b/303885539
Change-Id: I4d09400e133b4d44353d601d07e13917e096a3eb
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/175310
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Christoph Klee <chklee@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Austin Foxley <afoxley@google.com>
Reviewed-by: Jonathon Reinhart <jrreinhart@google.com>
1 file changed
tree: efe72de62fdf5999cf9d44e951faa9194deb8896
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. pw_alignment/
  7. pw_allocator/
  8. pw_analog/
  9. pw_android_toolchain/
  10. pw_arduino_build/
  11. pw_assert/
  12. pw_assert_basic/
  13. pw_assert_log/
  14. pw_assert_tokenized/
  15. pw_assert_zephyr/
  16. pw_async/
  17. pw_async_basic/
  18. pw_base64/
  19. pw_bloat/
  20. pw_blob_store/
  21. pw_bluetooth/
  22. pw_bluetooth_hci/
  23. pw_bluetooth_profiles/
  24. pw_boot/
  25. pw_boot_cortex_m/
  26. pw_build/
  27. pw_build_info/
  28. pw_build_mcuxpresso/
  29. pw_bytes/
  30. pw_checksum/
  31. pw_chre/
  32. pw_chrono/
  33. pw_chrono_embos/
  34. pw_chrono_freertos/
  35. pw_chrono_rp2040/
  36. pw_chrono_stl/
  37. pw_chrono_threadx/
  38. pw_chrono_zephyr/
  39. pw_cli/
  40. pw_compilation_testing/
  41. pw_console/
  42. pw_containers/
  43. pw_cpu_exception/
  44. pw_cpu_exception_cortex_m/
  45. pw_crypto/
  46. pw_digital_io/
  47. pw_digital_io_mcuxpresso/
  48. pw_digital_io_rp2040/
  49. pw_docgen/
  50. pw_doctor/
  51. pw_env_setup/
  52. pw_file/
  53. pw_function/
  54. pw_fuzzer/
  55. pw_hdlc/
  56. pw_hex_dump/
  57. pw_i2c/
  58. pw_i2c_linux/
  59. pw_i2c_mcuxpresso/
  60. pw_ide/
  61. pw_interrupt/
  62. pw_interrupt_cortex_m/
  63. pw_interrupt_xtensa/
  64. pw_interrupt_zephyr/
  65. pw_intrusive_ptr/
  66. pw_kvs/
  67. pw_libc/
  68. pw_log/
  69. pw_log_android/
  70. pw_log_basic/
  71. pw_log_null/
  72. pw_log_rpc/
  73. pw_log_string/
  74. pw_log_tokenized/
  75. pw_log_zephyr/
  76. pw_malloc/
  77. pw_malloc_freelist/
  78. pw_metric/
  79. pw_minimal_cpp_stdlib/
  80. pw_module/
  81. pw_multisink/
  82. pw_package/
  83. pw_perf_test/
  84. pw_persistent_ram/
  85. pw_polyfill/
  86. pw_preprocessor/
  87. pw_presubmit/
  88. pw_protobuf/
  89. pw_protobuf_compiler/
  90. pw_random/
  91. pw_result/
  92. pw_ring_buffer/
  93. pw_router/
  94. pw_rpc/
  95. pw_rpc_transport/
  96. pw_rust/
  97. pw_snapshot/
  98. pw_software_update/
  99. pw_span/
  100. pw_spi/
  101. pw_spi_mcuxpresso/
  102. pw_status/
  103. pw_stm32cube_build/
  104. pw_stream/
  105. pw_stream_shmem_mcuxpresso/
  106. pw_stream_uart_linux/
  107. pw_stream_uart_mcuxpresso/
  108. pw_string/
  109. pw_symbolizer/
  110. pw_sync/
  111. pw_sync_baremetal/
  112. pw_sync_embos/
  113. pw_sync_freertos/
  114. pw_sync_stl/
  115. pw_sync_threadx/
  116. pw_sync_zephyr/
  117. pw_sys_io/
  118. pw_sys_io_ambiq_sdk/
  119. pw_sys_io_arduino/
  120. pw_sys_io_baremetal_lm3s6965evb/
  121. pw_sys_io_baremetal_stm32f429/
  122. pw_sys_io_emcraft_sf2/
  123. pw_sys_io_mcuxpresso/
  124. pw_sys_io_rp2040/
  125. pw_sys_io_stdio/
  126. pw_sys_io_stm32cube/
  127. pw_sys_io_zephyr/
  128. pw_system/
  129. pw_target_runner/
  130. pw_thread/
  131. pw_thread_embos/
  132. pw_thread_freertos/
  133. pw_thread_stl/
  134. pw_thread_threadx/
  135. pw_thread_zephyr/
  136. pw_tls_client/
  137. pw_tls_client_boringssl/
  138. pw_tls_client_mbedtls/
  139. pw_tokenizer/
  140. pw_tool/
  141. pw_toolchain/
  142. pw_toolchain_bazel/
  143. pw_trace/
  144. pw_trace_tokenized/
  145. pw_transfer/
  146. pw_unit_test/
  147. pw_unit_test_zephyr/
  148. pw_varint/
  149. pw_watch/
  150. pw_web/
  151. pw_work_queue/
  152. seed/
  153. targets/
  154. third_party/
  155. ts/
  156. zephyr/
  157. .bazelignore
  158. .bazelrc
  159. .black.toml
  160. .clang-format
  161. .clang-tidy
  162. .eslintrc.cjs
  163. .git-blame-ignore-revs
  164. .gitattributes
  165. .gitignore
  166. .gn
  167. .mypy.ini
  168. .prettierignore
  169. .prettierrc.cjs
  170. .pw_ide.yaml
  171. .pylintrc
  172. activate.bat
  173. Android.bp
  174. AUTHORS
  175. bootstrap.bat
  176. bootstrap.sh
  177. BUILD.bazel
  178. BUILD.gn
  179. BUILDCONFIG.gn
  180. CMakeLists.txt
  181. jest.config.ts
  182. Kconfig.zephyr
  183. LICENSE
  184. modules.gni
  185. OWNERS
  186. package-lock.json
  187. package.json
  188. pigweed.json
  189. PIGWEED_MODULES
  190. README.md
  191. rollup.config.js
  192. tsconfig.json
  193. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links