pw_transfer: Set RPC streams directly

Rather than passing the RPC stream to the transfer thread to be moved,
set it directly. pw_rpc call objects are synchronized by pw_rpc, so it
is safe to move them between threads.

With upcoming pw_rpc changes, a thread will wait until an RPC call's
callbacks finish before moving the call object. This could cause
deadlocks in pw_transfer if a packet arrives immediately after the
stream starts, before the transfer thread gets a chance to move the call
object to its final location. The RPC thread would wait for the next
event to be available in the callback, while the transfer thread would
wait to move the new call object out of the next event until the
callback completed, resulting in deadlock. This change avoids this
issue without needing to drop any packets.

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