pw_async2_epoll: Use unordered_map; silence persistent warnings

Rather than adding and removing read and write wakers to a vector, use
an unordered_map that maps a file descriptor to read and write wakers.

Also, silence unnecessary warning logs. Previously, epoll dispatcher
frequently emitted these warnings:

  WRN Received an event for registered file descriptor 4, but there is
      no task to wake

This warning would occur with every read. This is because epoll emits
both EPOLLIN and EPOLLOUT events when reading from a read/write channel,
resulting in unhandled write events, even though no tasks are trying to
write.

Retain the log as a debug-level log, and only trigger it if no tasks
were waiting for either reads or writes.

Change-Id: I241776d8d9f6cce01fbdf95babebd48bd5bd81fe
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/218860
Reviewed-by: Alexei Frolov <frolv@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
3 files changed
tree: f81d4ee24f5fbebda2cb5a3fa5af74a757eec998
  1. .allstar/
  2. .github/
  3. .vscode/
  4. build_overrides/
  5. docker/
  6. docs/
  7. kudzu/
  8. pw_alignment/
  9. pw_allocator/
  10. pw_analog/
  11. pw_android_toolchain/
  12. pw_arduino_build/
  13. pw_assert/
  14. pw_assert_basic/
  15. pw_assert_log/
  16. pw_assert_tokenized/
  17. pw_assert_zephyr/
  18. pw_async/
  19. pw_async2/
  20. pw_async2_basic/
  21. pw_async2_epoll/
  22. pw_async_basic/
  23. pw_base64/
  24. pw_bloat/
  25. pw_blob_store/
  26. pw_bluetooth/
  27. pw_bluetooth_hci/
  28. pw_bluetooth_profiles/
  29. pw_bluetooth_proxy/
  30. pw_bluetooth_sapphire/
  31. pw_boot/
  32. pw_boot_cortex_m/
  33. pw_build/
  34. pw_build_android/
  35. pw_build_info/
  36. pw_build_mcuxpresso/
  37. pw_bytes/
  38. pw_channel/
  39. pw_checksum/
  40. pw_chre/
  41. pw_chrono/
  42. pw_chrono_embos/
  43. pw_chrono_freertos/
  44. pw_chrono_rp2040/
  45. pw_chrono_stl/
  46. pw_chrono_threadx/
  47. pw_chrono_zephyr/
  48. pw_cli/
  49. pw_clock_tree/
  50. pw_clock_tree_mcuxpresso/
  51. pw_compilation_testing/
  52. pw_config_loader/
  53. pw_console/
  54. pw_containers/
  55. pw_cpu_exception/
  56. pw_cpu_exception_cortex_m/
  57. pw_cpu_exception_risc_v/
  58. pw_crypto/
  59. pw_digital_io/
  60. pw_digital_io_linux/
  61. pw_digital_io_mcuxpresso/
  62. pw_digital_io_rp2040/
  63. pw_dma_mcuxpresso/
  64. pw_docgen/
  65. pw_doctor/
  66. pw_emu/
  67. pw_env_setup/
  68. pw_env_setup_zephyr/
  69. pw_file/
  70. pw_format/
  71. pw_function/
  72. pw_fuzzer/
  73. pw_grpc/
  74. pw_hdlc/
  75. pw_hex_dump/
  76. pw_i2c/
  77. pw_i2c_linux/
  78. pw_i2c_mcuxpresso/
  79. pw_i2c_rp2040/
  80. pw_ide/
  81. pw_interrupt/
  82. pw_interrupt_cortex_m/
  83. pw_interrupt_xtensa/
  84. pw_interrupt_zephyr/
  85. pw_intrusive_ptr/
  86. pw_json/
  87. pw_kvs/
  88. pw_libc/
  89. pw_libcxx/
  90. pw_log/
  91. pw_log_android/
  92. pw_log_basic/
  93. pw_log_null/
  94. pw_log_rpc/
  95. pw_log_string/
  96. pw_log_tokenized/
  97. pw_log_zephyr/
  98. pw_malloc/
  99. pw_malloc_freelist/
  100. pw_malloc_freertos/
  101. pw_metric/
  102. pw_minimal_cpp_stdlib/
  103. pw_module/
  104. pw_multibuf/
  105. pw_multisink/
  106. pw_package/
  107. pw_perf_test/
  108. pw_persistent_ram/
  109. pw_polyfill/
  110. pw_preprocessor/
  111. pw_presubmit/
  112. pw_protobuf/
  113. pw_protobuf_compiler/
  114. pw_random/
  115. pw_result/
  116. pw_ring_buffer/
  117. pw_router/
  118. pw_rpc/
  119. pw_rpc_transport/
  120. pw_rust/
  121. pw_sensor/
  122. pw_snapshot/
  123. pw_software_update/
  124. pw_span/
  125. pw_spi/
  126. pw_spi_linux/
  127. pw_spi_mcuxpresso/
  128. pw_spi_rp2040/
  129. pw_status/
  130. pw_stm32cube_build/
  131. pw_stream/
  132. pw_stream_shmem_mcuxpresso/
  133. pw_stream_uart_linux/
  134. pw_stream_uart_mcuxpresso/
  135. pw_string/
  136. pw_symbolizer/
  137. pw_sync/
  138. pw_sync_baremetal/
  139. pw_sync_embos/
  140. pw_sync_freertos/
  141. pw_sync_stl/
  142. pw_sync_threadx/
  143. pw_sync_zephyr/
  144. pw_sys_io/
  145. pw_sys_io_ambiq_sdk/
  146. pw_sys_io_arduino/
  147. pw_sys_io_baremetal_lm3s6965evb/
  148. pw_sys_io_baremetal_stm32f429/
  149. pw_sys_io_emcraft_sf2/
  150. pw_sys_io_mcuxpresso/
  151. pw_sys_io_rp2040/
  152. pw_sys_io_stdio/
  153. pw_sys_io_stm32cube/
  154. pw_sys_io_zephyr/
  155. pw_system/
  156. pw_target_runner/
  157. pw_thread/
  158. pw_thread_embos/
  159. pw_thread_freertos/
  160. pw_thread_stl/
  161. pw_thread_threadx/
  162. pw_thread_zephyr/
  163. pw_tls_client/
  164. pw_tls_client_boringssl/
  165. pw_tls_client_mbedtls/
  166. pw_tokenizer/
  167. pw_toolchain/
  168. pw_toolchain_bazel/
  169. pw_trace/
  170. pw_trace_tokenized/
  171. pw_transfer/
  172. pw_uart/
  173. pw_unit_test/
  174. pw_unit_test_zephyr/
  175. pw_varint/
  176. pw_watch/
  177. pw_web/
  178. pw_work_queue/
  179. seed/
  180. targets/
  181. third_party/
  182. ts/
  183. zephyr/
  184. .bazelignore
  185. .bazelrc
  186. .bazelversion
  187. .black.toml
  188. .clang-format
  189. .clang-tidy
  190. .eslintrc.cjs
  191. .git-blame-ignore-revs
  192. .gitattributes
  193. .gitignore
  194. .gn
  195. .mypy.ini
  196. .prettierignore
  197. .prettierrc.cjs
  198. .pw_ide.yaml
  199. .pylintrc
  200. activate.bat
  201. Android.bp
  202. AUTHORS
  203. bootstrap.bat
  204. bootstrap.fish
  205. bootstrap.sh
  206. BUILD.bazel
  207. BUILD.gn
  208. BUILDCONFIG.gn
  209. CMakeLists.txt
  210. jest.config.ts
  211. Kconfig.zephyr
  212. LICENSE
  213. modules.gni
  214. OWNERS
  215. package-lock.json
  216. package.json
  217. pigweed.json
  218. PIGWEED_MODULES
  219. README.md
  220. rollup.config.js
  221. tsconfig.json
  222. WORKSPACE
  223. WORKSPACE_OWNERS
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