Skip to content

Commit 2095185

Browse files
committed
fix compare_exchange
1 parent 398f5a9 commit 2095185

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mprober"
3-
version = "0.11.0-beta.6"
3+
version = "0.11.0-beta.7"
44
authors = ["Magic Len <len@magiclen.org>"]
55
edition = "2018"
66
repository = "https://github.com/magiclen/m-prober"

src/rocket_mounts/api/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn detect_all_sleep(detect_interval: Duration, strict: bool) {
186186
}
187187

188188
fn fetch_cpus_stat(detect_interval: Duration) {
189-
if CPUS_STAT_DOING.compare_exchange(false, true, Ordering::Relaxed, Ordering::Relaxed).is_err()
189+
if CPUS_STAT_DOING.compare_exchange(false, true, Ordering::Relaxed, Ordering::Relaxed).is_ok()
190190
{
191191
CPUS_STAT_LATEST_DETECT.lock().unwrap().replace(Instant::now());
192192
thread::spawn(move || {
@@ -203,7 +203,7 @@ fn fetch_cpus_stat(detect_interval: Duration) {
203203
fn fetch_network_stat(detect_interval: Duration) {
204204
if NETWORK_STAT_DOING
205205
.compare_exchange(false, true, Ordering::Relaxed, Ordering::Relaxed)
206-
.is_err()
206+
.is_ok()
207207
{
208208
NETWORK_STAT_LATEST_DETECT.lock().unwrap().replace(Instant::now());
209209
thread::spawn(move || {
@@ -219,7 +219,7 @@ fn fetch_network_stat(detect_interval: Duration) {
219219
fn fetch_volumes_stat(detect_interval: Duration) {
220220
if VOLUMES_STAT_DOING
221221
.compare_exchange(false, true, Ordering::Relaxed, Ordering::Relaxed)
222-
.is_err()
222+
.is_ok()
223223
{
224224
VOLUMES_STAT_LATEST_DETECT.lock().unwrap().replace(Instant::now());
225225
thread::spawn(move || {

0 commit comments

Comments
 (0)