Register new snapshots

Also convert a number of `static mut` to just a plain old `static` and remove
some unsafe blocks.
This commit is contained in:
Alex Crichton
2014-10-10 21:59:10 -07:00
parent 1add4dedc1
commit dae48a07f3
36 changed files with 107 additions and 307 deletions

View File

@@ -230,11 +230,11 @@ pub mod dl {
pub fn check_for_errors_in<T>(f: || -> T) -> Result<T, String> {
use rt::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT;
static LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
unsafe {
// dlerror isn't thread safe, so we need to lock around this entire
// sequence
let _guard = lock.lock();
let _guard = LOCK.lock();
let _old_error = dlerror();
let result = f();