rust-windowing / rust-windowing/softbuffer

`Buffer<'_>` shouldn't be `Send`

Open
#347 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug DS - Android NDK
Dominant language
Rust
Stars
506
Forks
85
PR merge metrics
No merged PRs in 30d

Description

Android holds a lock on the buffer while it's in use, see https://github.com/rust-windowing/softbuffer/pull/331, and I'm experimenting a bit with a similar design on macOS (which is to say, I think it's a reasonable thing for our buffers to do).

MutexGuards are not Send though, which makes me wonder if this is sound?

Is there a use-case for Buffer<'_> being Send? As-in, is there ever a case where you would want to present on a different thread than the one that called next_buffer()? The problem wouldn't exist if you moved the entire Surface to a different thread.

I can see the argument for buffers being Sync though (&mut T is Sync), it could maybe make sense to pass the buffer to a scoped thread and render in that.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Buffer and Surface APIs around next_buffer(), focusing on how presenting relates to thread transfer and platform locking. Compare the Android rationale in softbuffer PR #331 and evaluate the existing Send and Sync behavior; done means reaching a clear decision about Buffer's thread-safety contract and recording or implementing it.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, desktop-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.