mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2024-12-12 19:18:24 +02:00
modify_ordering
This commit is contained in:
parent
648a65f197
commit
026ed4de84
@ -99,19 +99,19 @@ macro_rules! ignore_message {
|
|||||||
|
|
||||||
/// Returns true if and only if messages should be shown.
|
/// Returns true if and only if messages should be shown.
|
||||||
pub(crate) fn messages() -> bool {
|
pub(crate) fn messages() -> bool {
|
||||||
MESSAGES.load(Ordering::SeqCst)
|
MESSAGES.load(Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set whether messages should be shown or not.
|
/// Set whether messages should be shown or not.
|
||||||
///
|
///
|
||||||
/// By default, they are not shown.
|
/// By default, they are not shown.
|
||||||
pub(crate) fn set_messages(yes: bool) {
|
pub(crate) fn set_messages(yes: bool) {
|
||||||
MESSAGES.store(yes, Ordering::SeqCst)
|
MESSAGES.store(yes, Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if and only if "ignore" related messages should be shown.
|
/// Returns true if and only if "ignore" related messages should be shown.
|
||||||
pub(crate) fn ignore_messages() -> bool {
|
pub(crate) fn ignore_messages() -> bool {
|
||||||
IGNORE_MESSAGES.load(Ordering::SeqCst)
|
IGNORE_MESSAGES.load(Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set whether "ignore" related messages should be shown or not.
|
/// Set whether "ignore" related messages should be shown or not.
|
||||||
@ -122,12 +122,12 @@ pub(crate) fn ignore_messages() -> bool {
|
|||||||
/// `messages` is disabled, then "ignore" messages are never shown, regardless
|
/// `messages` is disabled, then "ignore" messages are never shown, regardless
|
||||||
/// of this setting.
|
/// of this setting.
|
||||||
pub(crate) fn set_ignore_messages(yes: bool) {
|
pub(crate) fn set_ignore_messages(yes: bool) {
|
||||||
IGNORE_MESSAGES.store(yes, Ordering::SeqCst)
|
IGNORE_MESSAGES.store(yes, Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if and only if ripgrep came across a non-fatal error.
|
/// Returns true if and only if ripgrep came across a non-fatal error.
|
||||||
pub(crate) fn errored() -> bool {
|
pub(crate) fn errored() -> bool {
|
||||||
ERRORED.load(Ordering::SeqCst)
|
ERRORED.load(Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Indicate that ripgrep has come across a non-fatal error.
|
/// Indicate that ripgrep has come across a non-fatal error.
|
||||||
@ -135,5 +135,5 @@ pub(crate) fn errored() -> bool {
|
|||||||
/// Callers should not use this directly. Instead, it is called automatically
|
/// Callers should not use this directly. Instead, it is called automatically
|
||||||
/// via the `err_message` macro.
|
/// via the `err_message` macro.
|
||||||
pub(crate) fn set_errored() {
|
pub(crate) fn set_errored() {
|
||||||
ERRORED.store(true, Ordering::SeqCst);
|
ERRORED.store(true, Ordering::Relaxed);
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ mod tests {
|
|||||||
|
|
||||||
let tmpdir = env::temp_dir();
|
let tmpdir = env::temp_dir();
|
||||||
for _ in 0..TRIES {
|
for _ in 0..TRIES {
|
||||||
let count = COUNTER.fetch_add(1, Ordering::SeqCst);
|
let count = COUNTER.fetch_add(1, Ordering::Relaxed);
|
||||||
let path = tmpdir.join("rust-ignore").join(count.to_string());
|
let path = tmpdir.join("rust-ignore").join(count.to_string());
|
||||||
if path.is_dir() {
|
if path.is_dir() {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1712,12 +1712,12 @@ impl<'s> Worker<'s> {
|
|||||||
|
|
||||||
/// Indicates that all workers should quit immediately.
|
/// Indicates that all workers should quit immediately.
|
||||||
fn quit_now(&self) {
|
fn quit_now(&self) {
|
||||||
self.quit_now.store(true, AtomicOrdering::SeqCst);
|
self.quit_now.store(true, AtomicOrdering::Release);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if this worker should quit immediately.
|
/// Returns true if this worker should quit immediately.
|
||||||
fn is_quit_now(&self) -> bool {
|
fn is_quit_now(&self) -> bool {
|
||||||
self.quit_now.load(AtomicOrdering::SeqCst)
|
self.quit_now.load(AtomicOrdering::Acquire)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send work.
|
/// Send work.
|
||||||
|
@ -68,7 +68,7 @@ impl Dir {
|
|||||||
/// does not need to be distinct for each invocation, but should correspond
|
/// does not need to be distinct for each invocation, but should correspond
|
||||||
/// to a logical grouping of tests.
|
/// to a logical grouping of tests.
|
||||||
pub fn new(name: &str) -> Dir {
|
pub fn new(name: &str) -> Dir {
|
||||||
let id = NEXT_ID.fetch_add(1, Ordering::SeqCst);
|
let id = NEXT_ID.fetch_add(1, Ordering::Relaxed);
|
||||||
let root = env::current_exe()
|
let root = env::current_exe()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.parent()
|
.parent()
|
||||||
|
Loading…
Reference in New Issue
Block a user