rust-mobile / ndk

Rust bindings to the Android NDK
Apache License 2.0
1.11k stars 110 forks source link

looper: Require `Send` when adding fd event callbacks on `ForeignLooper` #469

Closed MarijnS95 closed 4 months ago

MarijnS95 commented 7 months ago

ForeignLooper allows (re)registering callbacks on threads that are not the ThreadLooper (current) thread. Since these calls will be executed on that ThreadLooper thread when the user calls any of the poll() functions, these closures have to pass a thread boundary which requires Send.

MarijnS95 commented 7 months ago

Found a way, ~but I think add_fd_with_callback_assume_send() should be unsafe.~ done.