Skip to content

Commit

Permalink
Rewrite set_logger function to use std::sync::Once on std
Browse files Browse the repository at this point in the history
I split implementations for 3 cases:
* When std is available, use standard locking primitive.
* When std is not available but there is atomics with pointer size, use spinlock
* If there is no atomic with pointer size, assume that there is no threads and use `Cell`.

I think, this separation makes easier to understand what is happening in each case.
  • Loading branch information
AngelicosPhosphoros committed Dec 19, 2023
1 parent c5ddd6f commit 70affcf
Show file tree
Hide file tree
Showing 3 changed files with 286 additions and 121 deletions.
4 changes: 2 additions & 2 deletions src/__private_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use self::sealed::KVs;
use crate::{Level, Metadata, Record};
use std::fmt::Arguments;
pub use std::{file, format_args, line, module_path, stringify};
use core::fmt::Arguments;
pub use core::{file, format_args, line, module_path, stringify};

#[cfg(feature = "kv_unstable")]
pub type Value<'a> = dyn crate::kv::value::ToValue + 'a;
Expand Down
Loading

0 comments on commit 70affcf

Please sign in to comment.