mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Clean up deprecations (#8300)
* vm: replace fetch_update() with try_update() fetch_update() in atomic namespace is in the deprecation stage. * host_env: replace libc::RLIM_NLIMITS with const RLIM_NLIMITS Define a new const, RLIM_NLIMITS instead of libc::RLIM_NLIMITS in order to clean up the deprecated const and to prevent breaking API where the const is still used.
This commit is contained in:
1 parent
20cb866c67
commit
b052b16e6a
3 files changed
+5
-5
No files matched your search
@@ -7,9 +7,6 @@ pub use libc::{
|
||||
RLIMIT_NOFILE, RLIMIT_NPROC, RLIMIT_RSS, RLIMIT_STACK, c_long, rlim_t, rlimit, timeval,
|
||||
};
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub use libc::RLIM_NLIMITS;
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))]
|
||||
pub use libc::{RLIMIT_MSGQUEUE, RLIMIT_NICE, RLIMIT_RTPRIO, RLIMIT_SIGPENDING};
|
||||
|
||||
@@ -36,6 +33,9 @@ pub use libc::RUSAGE_THREAD;
|
||||
#[cfg(not(any(target_os = "windows", target_os = "redox")))]
|
||||
pub use libc::{RUSAGE_CHILDREN, RUSAGE_SELF};
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub const RLIM_NLIMITS: libc::c_int = 16;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct RUsage {
|
||||
pub ru_utime: libc::timeval,
|
||||
|
||||
@@ -87,7 +87,7 @@ static FUNC_VERSION_COUNTER: AtomicU32 = AtomicU32::new(1);
|
||||
/// Once the counter wraps to 0, it stays at 0 permanently.
|
||||
fn next_func_version() -> u32 {
|
||||
FUNC_VERSION_COUNTER
|
||||
.fetch_update(Relaxed, Relaxed, |v| (v != 0).then(|| v.wrapping_add(1)))
|
||||
.try_update(Relaxed, Relaxed, |v| (v != 0).then(|| v.wrapping_add(1)))
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
||||
|
||||
@@ -680,7 +680,7 @@ impl PyType {
|
||||
let flags_bits = flags.bits();
|
||||
let _ = self
|
||||
.abc_tpflags
|
||||
.fetch_update(Ordering::AcqRel, Ordering::Acquire, |old| {
|
||||
.try_update(Ordering::AcqRel, Ordering::Acquire, |old| {
|
||||
Some((old & !collection_bits) | flags_bits)
|
||||
});
|
||||
self.modified();
|
||||
|
||||
Reference in new issue
Block a user