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

fix(subscriber): fix compilation on targets without 64-bit atomics #282

Merged
merged 2 commits into from
Feb 14, 2022

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Feb 14, 2022

Motivation

Currently, the console-subscriber crate does not compile on targets
without 64-bit atomic operations, such as mipsel-unknown-linux-musl.
This is because a 64-bit atomic is used to store the last task ID that
polled a resource.

Solution

This branch changes this code to use the AtomicCell type from
crossbeam-utils, instead. AtomicCell will use atomic operations on
targets that support 64-bit atomics, and fall back to using a mutex on
platforms that don't have 64-bit atomic operations. This should fix the
build on those platforms.

Fixes #279

## Motivation

Currently, the `console-subscriber` crate does not compile on targets
without 64-bit atomic operations, such as `mipsel-unknown-linux-musl`.
This is because a 64-bit atomic is used to store the last task ID that
polled a resource.

## Solution

This branch changes this code to use the `AtomicCell` type from
`crossbeam-utils`, instead. `AtomicCell` will use atomic operations on
targets that support 64-bit atomics, and fall back to using a mutex on
platforms that don't have 64-bit atomic operations. This should fix the
build on those platforms.

Fixes #279
@hawkw
Copy link
Member Author

hawkw commented Feb 14, 2022

@spacemeowx2, would you mind checking out this branch and verifying that it does, in fact, fix the build issues you reported in #279? I wasn't able to easily verify the fix, as I'm running NixOS, and the cross tool doesn't currently work on NixOS (cross-rs/cross#524).

Thank you!

@spacemeowx2
Copy link

It compiles with e0afa98

Thanks!

@hawkw
Copy link
Member Author

hawkw commented Feb 14, 2022

@spacemeowx2 great, thanks for checking that for me!

@hawkw hawkw merged commit 5590fdb into main Feb 14, 2022
@hawkw hawkw deleted the eliza/fix-mipsel branch February 14, 2022 19:41
hawkw added a commit that referenced this pull request Feb 18, 2022
## 0.1.3  (2022-02-18)

#### Bug Fixes

*  record timestamps for updates last (#289) ([703f1aa](703f1aa),
   closes [#266](266))
*  use monotonic `Instant`s for all timestamps (#288)
   ([abc0830](abc0830), closes [#286](286))
*  bail rather than panic when encountering clock skew (#287)
   ([24db8c6](24db8c6), closes [#286](286))
*  fix compilation on targets without 64-bit atomics (#282)
   ([5590fdb](5590fdb), closes [#279](279))
hawkw added a commit that referenced this pull request Feb 18, 2022
#### Features

*  add `Builder::filter_env_var` builder parameter (#276)
   ([dbdb149](dbdb149), closes [#206](206))

#### Bug Fixes

*  record timestamps for updates last (#289) ([703f1aa](703f1aa),
   closes [#266](266))
*  use monotonic `Instant`s for all timestamps (#288)
   ([abc0830](abc0830), closes [#286](286))
*  bail rather than panic when encountering clock skew (#287)
   ([24db8c6](24db8c6), closes [#286](286))
*  fix compilation on targets without 64-bit atomics (#282)
   ([5590fdb](5590fdb), closes [#279](279))
hawkw added a commit that referenced this pull request Feb 18, 2022
#### Features

*  add `Builder::filter_env_var` builder parameter (#276)
   ([dbdb149](dbdb149), closes [#206](206))

#### Bug Fixes

*  record timestamps for updates last (#289) ([703f1aa](703f1aa),
   closes [#266](266))
*  use monotonic `Instant`s for all timestamps (#288)
   ([abc0830](abc0830), closes [#286](286))
*  bail rather than panic when encountering clock skew (#287)
   ([24db8c6](24db8c6), closes [#286](286))
*  fix compilation on targets without 64-bit atomics (#282)
   ([5590fdb](5590fdb), closes [#279](279))
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.

Support for platforms where AtomicU64 does not exist
2 participants