mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-01 06:52:54 +00:00
Compare commits
1 Commits
python-bin
...
0.8.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f07dc35d8 |
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tantivy"
|
name = "tantivy"
|
||||||
version = "0.8.0"
|
version = "0.8.2"
|
||||||
authors = ["Paul Masurel <paul.masurel@gmail.com>"]
|
authors = ["Paul Masurel <paul.masurel@gmail.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
categories = ["database-implementations", "data-structures"]
|
categories = ["database-implementations", "data-structures"]
|
||||||
|
|||||||
@@ -27,22 +27,22 @@ mod archicture_impl {
|
|||||||
#[cfg(not(target_arch = "x86_64"))]
|
#[cfg(not(target_arch = "x86_64"))]
|
||||||
mod archicture_impl {
|
mod archicture_impl {
|
||||||
|
|
||||||
/// Under other architecture, we rely on a mutex.
|
|
||||||
use std::sync::Mutex;
|
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
|
/// Under other architecture, we rely on a mutex.
|
||||||
|
use std::sync::RwLock;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct AtomicU64Ersatz(Mutex<u64>);
|
pub struct AtomicU64Ersatz(RwLock<u64>);
|
||||||
|
|
||||||
impl AtomicU64Ersatz {
|
impl AtomicU64Ersatz {
|
||||||
pub fn new(first_opstamp: u64) -> AtomicU64Ersatz {
|
pub fn new(first_opstamp: u64) -> AtomicU64Ersatz {
|
||||||
AtomicU64Ersatz(AtomicUsize::new(first_opstamp))
|
AtomicU64Ersatz(RwLock::new(first_opstamp))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fetch_add(&self, val: u64, _order: Ordering) -> u64 {
|
pub fn fetch_add(&self, incr: u64, _order: Ordering) -> u64 {
|
||||||
let lock = self.0.lock().unwrap();
|
let mut lock = self.0.write().unwrap();
|
||||||
let previous_val = *lock;
|
let previous_val = *lock;
|
||||||
*lock = previous_val + 1;
|
*lock = previous_val + incr;
|
||||||
previous_val
|
previous_val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user