From 2258c7bb73e6f610752e964e10abbf2473d793ff Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Fri, 17 Oct 2014 22:34:09 +0400 Subject: [PATCH] Removed unneeded `sqlite3_threadsafe()` check Since the database is accessed from 1 thread only thanks to `key` parameter of `driver_async`. In fact we could previously potentially access the same DB twice from different emulator threads precisely when SQLite3 is compiled in single-thread mode. --- c_src/sqlite3_drv.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/c_src/sqlite3_drv.c b/c_src/sqlite3_drv.c index 066fd0a..46bb195 100644 --- a/c_src/sqlite3_drv.c +++ b/c_src/sqlite3_drv.c @@ -423,13 +423,8 @@ static inline async_sqlite3_command *make_async_command_script( static inline void exec_async_command( sqlite3_drv_t *drv, void (*async_invoke)(void*), async_sqlite3_command *async_command) { - if (sqlite3_threadsafe()) { - drv->async_handle = driver_async(drv->port, &drv->key, async_invoke, - async_command, sql_free_async); - } else { - async_invoke(async_command); - ready_async((ErlDrvData) drv, (ErlDrvThreadData) async_command); - } + drv->async_handle = driver_async(drv->port, &drv->key, async_invoke, + async_command, sql_free_async); } static inline int sql_exec_statement(