-
Notifications
You must be signed in to change notification settings - Fork 339
Change task counter AtomicU64 to AtomicU32 #141
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
I worry that 32 bits might not be enough and that one could easily spawn tasks in a loop and overflow the counter. Perhaps we could "simulate" 64-bit atomics on platforms that don't support them with a mutex or some kind of trick with two 32-bit atomic numbers? |
Can we set it to |
I still worry that the IDs could be overflowed on 32-bit platforms. |
Perhaps like this: cfg_if::cfg_if! {
if #[cfg(target_pointer_width = "64")] {
pub(crate) use std::sync::atomic::AtomicU64;
} else {
#[derive(Debug)]
pub(crate) struct AtomicU64(std::sync::Mutex<u64>);
impl AtomicU64 {
pub(crate) fn load(&self, _: Ordering) -> u64 {
*self.0.lock().unwrap()
}
// .. some methods
}
}
} |
@taiki-e Yes, although I suggest using |
@stjepang Ah, Indeed. I missed that |
IMO |
I thought so before, but it seems that they want to find a better solution. |
It's totally fine for |
The new PR is here: #451 |
cross compile with mipsel-unknown-linux-uclibc(32bit) error: