On 28-09-23, 16:37, Erik Schilling wrote: > The thread-safety rules of libgpiod allow individual object instances to > be used from different threads. So far, this was not actually possible > with the Rust bindings. Not being `Send` disallowed the user to transfer > the ownership to different threads. > > Rust also has a `Sync` marker. That one would even allow sending > references of objects to other threads. Since we wrap a lot of C > functions with `fn foo(&self)` signatures, that would not be safe. > libgpiod does not allow concurrent API calls to the same object instance > - which Rust would allow for read-only references. Thus, we do not > define that one. > > Chip was already modeled correctly. > > line::Info is not marked as Send since it may either be owning or non- > owning. That problem is fixed as part of a separate pull request [1]. > > [1] https://lore.kernel.org/r/20230927-rust-line-info-soundness-v1-0-990dce6f18ab@xxxxxxxxxx > > Link: https://lore.kernel.org/r/CVHO091CC80Y.3KUOSLSOBVL0T@ablu-work > Signed-off-by: Erik Schilling <erik.schilling@xxxxxxxxxx> > --- > bindings/rust/libgpiod/src/edge_event.rs | 4 ++++ > bindings/rust/libgpiod/src/event_buffer.rs | 8 ++++++++ > bindings/rust/libgpiod/src/info_event.rs | 4 ++++ > bindings/rust/libgpiod/src/line_config.rs | 4 ++++ > bindings/rust/libgpiod/src/line_request.rs | 4 ++++ > bindings/rust/libgpiod/src/line_settings.rs | 4 ++++ > bindings/rust/libgpiod/src/request_config.rs | 4 ++++ > 7 files changed, 32 insertions(+) Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx> -- viresh