Skip to content

Commit

Permalink
Use portable-atomic to support PowerPC
Browse files Browse the repository at this point in the history
Use the portable-atomic crate to fix build failure on PowerPC target
that does not support 64-bit atomics natively:

```
error[E0432]: unresolved import `std::sync::atomic::AtomicU64`
 --> src/archive.rs:7:18
  |
7 |         atomic::{AtomicU64, Ordering},
  |                  ^^^^^^^^^
  |                  |
  |                  no `AtomicU64` in `sync::atomic`
  |                  help: a similar name exists in the module: `AtomicU32`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `tokio-tar` (lib) due to 1 previous error
```
  • Loading branch information
mgorny committed Apr 27, 2024
1 parent 87338a7 commit 6e99579
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ contents are never required to be entirely resident in memory all at once.
[dependencies]
filetime = "0.2"
futures-core = "0.3"
portable-atomic = "1"
tokio = { version = "1", features = ["fs", "io-util", "rt"] }
tokio-stream = "0.1"

Expand Down
5 changes: 4 additions & 1 deletion src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ use std::{
path::Path,
pin::Pin,
sync::{
atomic::{AtomicU64, Ordering},
Arc,
},
task::{Context, Poll},
};
use portable_atomic::{
AtomicU64,
Ordering,
};
use tokio::{
io::{self, AsyncRead as Read, AsyncReadExt},
sync::Mutex,
Expand Down

0 comments on commit 6e99579

Please sign in to comment.