Skip to content

Commit de700d3

Browse files
committed
Add platform condvar abstraction and cancellable busy handler
- Add timed_wait_t abstraction over pthread_cond_timedwait (POSIX) and SleepConditionVariableCS (Windows) - ~30 lines covering 100% of BEAM platforms - Extend connection_t with cancel_tw condvar, cancelled flag, busy_timeout_ms, and env+pid stashing for process-alive checks - Replace sqliteDefaultBusyCallback with exqlite_busy_handler that waits on condvar (instantly cancellable) and checks enif_is_process_alive - Add exqlite_progress_handler to interrupt long-running VDBE execution - Add exqlite_set_busy_timeout NIF (stores timeout without destroying handler, unlike PRAGMA busy_timeout which silently replaces custom handlers) - Add exqlite_cancel NIF (sets flag, signals condvar, calls sqlite3_interrupt) - Make cancel and set_busy_timeout non-dirty NIFs (must run on normal scheduler to avoid queueing behind stuck dirty NIFs) - Update destructor to signal cancel before close - Install handlers in exqlite_open, stash env+pid at 5 busy-triggerable call sites Fixes the busy handler plane of #192 - disconnect can now wake sleeping handlers instantly instead of waiting for busy_timeout to expire.
1 parent 1b24a10 commit de700d3

1 file changed

Lines changed: 320 additions & 2 deletions

File tree

0 commit comments

Comments
 (0)