On Fri, Sep 29, 2023 at 2:47 PM Erik Schilling <erik.schilling@xxxxxxxxxx> wrote: > > On Fri Sep 29, 2023 at 2:45 PM CEST, Bartosz Golaszewski wrote: > > On Fri, Sep 29, 2023 at 12:58 PM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote: > > > > > > 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> > > > > > > > Thanks, do you have any comments about the other patches in this series? > > Hm. The others are not Rust-related and mostly try to document our > discussion about thread-safety of the C lib. It would probably be good > if you could double-check that I summarized everything correctly. > > - Erik > Of course they aren't and I should have read them before assuming the entire series is for rust bindings. :) Thanks. Bart