android: Use event identifier instead of userdata pointer #1826
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ndk-glue currently sets both the
ident
field and user-data pointer to0
or1
for the event pipe and input queue respectively, to tell these sources apart. While it works to reinterpret thisdata
pointer as integer identifier it shouldn't be abused for that, in particular when one may wish to provide extra information with an event in the future; then thedata
field is used as pointer (or abused as abstract value) for that.These constants (
0
and1
) are internal tondk-glue
and not publicly documented anywhere (afaik). I believe they should at least be exposed as constants, or perhaps abstracted behind apoll
function internal tondk-glue
. Consequently we might want to warn API users when they try use one of these "reservedident
s" (but only on the thread looper set up byndk-glue
sinit()
function)?CC @dvc94ch @msiglreith
cargo fmt
has been run on this branchcargo doc
builds successfullyCHANGELOG.md
if knowledge of this change could be valuable to users