Mercurial > lbo > hg > leveldb-rs
view src/env_common.rs @ 478:591a2285c83c
Use flock(2) instead of fcntl(2) for locking databases.
In an attempt to fix fcntl errors on Mac OS X (bitbucket issue #4).
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Thu, 11 Jul 2019 19:42:15 +0200 |
parents | ca98661cf296 |
children | 0c3b736b2781 |
line wrap: on
line source
use std::thread; use std::time; pub fn micros() -> u64 { loop { let now = time::SystemTime::now().duration_since(time::UNIX_EPOCH); match now { Err(_) => continue, Ok(dur) => return dur.as_secs() * 1000000 + (dur.subsec_nanos() / 1000) as u64, } } } pub fn sleep_for(micros: u32) { thread::sleep(time::Duration::new(0, micros * 1000)); }