Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): Upgrade to ndk 0.9 and delete unused ndk-sys/context dependencies #1296

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

MarijnS95
Copy link

@MarijnS95 MarijnS95 commented Jun 17, 2024

Supersedes #1060, #1061

The ndk crate received some marginal API upgrades, besides fixing soundness issues. Specifcally, ForeignLooper::add_fd_with_callback() now signifies that the incoming file descriptor is a BorrowedFd and the callback is executed on a different thread (where the looper is polled on the ThreadLooper) and must hence be Send..

It appears the ndk-sys and ndk-context crates are not used directly, hence they are removed from Cargo.toml here.

The `ndk` crate received some marginal API upgrades, besides fixing
soundness issues.  Specifcally, `ForeignLooper::add_fd_with_callback()`
now signifies that the incoming file descriptor is a `BorrowedFd` and
the callback is executed on a different thread (where the looper is
polled on the `ThreadLooper`) and must hence be `Send.`.

It appears the `ndk-sys` and `ndk-context` crates are not used directly,
hence they are removed from `Cargo.toml` here.
@MarijnS95 MarijnS95 requested a review from a team as a code owner June 17, 2024 21:51
let mut pipe: [RawFd; 2] = Default::default();
unsafe { libc::pipe(pipe.as_mut_ptr()) };
pipe
unsafe { pipe.map(|fd| OwnedFd::from_raw_fd(fd)) }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be more convenient to use rustix here.

let size = std::mem::size_of::<bool>();
let mut wake = false;
if libc::read(MAIN_PIPE[0], &mut wake as *mut _ as *mut _, size) == size as libc::ssize_t {
if libc::read(fd.as_raw_fd(), &mut wake as *mut _ as *mut _, size) == size as libc::ssize_t {
main_pipe.recv().is_ok()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the compiler points out that main_pipe is not Send, so this won't compile.

@amrbashir amrbashir requested a review from wusyong June 27, 2024 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant