mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 19:41:37 +08:00
don't perform threading mode checks on wasm32
This commit is contained in:
parent
0acdb19a38
commit
09ad553081
@ -6,7 +6,7 @@ use std::path::Path;
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::{Arc, Mutex, Once};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
use super::ffi;
|
use super::ffi;
|
||||||
use super::{str_for_sqlite, str_to_cstring};
|
use super::{str_for_sqlite, str_to_cstring};
|
||||||
@ -324,7 +324,7 @@ impl Drop for InnerConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "bundled"))]
|
#[cfg(not(feature = "bundled"))]
|
||||||
static SQLITE_VERSION_CHECK: Once = Once::new();
|
static SQLITE_VERSION_CHECK: std::sync::Once = std::sync::Once::new();
|
||||||
#[cfg(not(feature = "bundled"))]
|
#[cfg(not(feature = "bundled"))]
|
||||||
pub static BYPASS_VERSION_CHECK: AtomicBool = AtomicBool::new(false);
|
pub static BYPASS_VERSION_CHECK: AtomicBool = AtomicBool::new(false);
|
||||||
|
|
||||||
@ -372,9 +372,25 @@ rusqlite was built against SQLite {} but the runtime SQLite version is {}. To fi
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static SQLITE_INIT: Once = Once::new();
|
#[cfg(not(any(
|
||||||
|
target_arch = "wasm32"
|
||||||
|
)))]
|
||||||
|
static SQLITE_INIT: std::sync::Once = std::sync::Once::new();
|
||||||
|
|
||||||
pub static BYPASS_SQLITE_INIT: AtomicBool = AtomicBool::new(false);
|
pub static BYPASS_SQLITE_INIT: AtomicBool = AtomicBool::new(false);
|
||||||
|
|
||||||
|
// threading mode checks are not necessary (and do not work) on target
|
||||||
|
// platforms that do not have threading (such as webassembly)
|
||||||
|
#[cfg(any(
|
||||||
|
target_arch = "wasm32"
|
||||||
|
))]
|
||||||
|
fn ensure_safe_sqlite_threading_mode() -> Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(any(
|
||||||
|
target_arch = "wasm32"
|
||||||
|
)))]
|
||||||
fn ensure_safe_sqlite_threading_mode() -> Result<()> {
|
fn ensure_safe_sqlite_threading_mode() -> Result<()> {
|
||||||
// Ensure SQLite was compiled in thredsafe mode.
|
// Ensure SQLite was compiled in thredsafe mode.
|
||||||
if unsafe { ffi::sqlite3_threadsafe() == 0 } {
|
if unsafe { ffi::sqlite3_threadsafe() == 0 } {
|
||||||
|
Loading…
Reference in New Issue
Block a user