Skip to content

Async compatibility (ActiveCamera can be Send?) #86

Description

@paul-fornage

I had been trying to use this library such that there are no blocked threads when waiting on a frame and after a couple days, I tried making ActiveCamera implement Send, and it seems to work. To be clear there are ways to make it async, but no way I could find that does not involve a thread getting CPU time with no work to do.

  • Is there a reason only Request and Stream were marked Send?
  • Am I missing a reason I shouldn't be doing that? I really don't know the project that well, and I can't rigorously prove it can be Send.

Why ActiveCamera can be Send

Again, don't really know what I'm doing here, but I thought I'd lay it out.

  1. It works. I'm using it now, while also passing between threads.
  2. Clanker said so.

Impact

It makes an async frame channel much easier.

Edit: heres the fork: [https://github.com/paul-fornage/libcamera-rs]

Not submitting a PR because I really can't confirm this doesn't break an edge case, and with all the FFI I don't trust myself to guarantee anything. But. On my machine, this works fine. If you think it looks good, I can submit it. (or just copy paste it, its + 1 line and + 1 file)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions