Skip to content

Commit 2cfa8e6

Browse files
committed
fix: remove stale condvar references in comments
1 parent bc3beee commit 2cfa8e6

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

c_src/sqlite3_nif.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,9 @@ statement_release_lock(statement_t* statement)
302302
// Custom busy handler
303303
//
304304
// Replaces SQLite's default busy handler (which sleeps via sqlite3OsSleep and
305-
// cannot be interrupted) with one that waits on a condvar. This lets cancel()
306-
// signal the condvar and wake the handler immediately, so disconnect() can
307-
// proceed without waiting for the full busy_timeout.
308-
//
309-
// Lock ordering: db->mutex (held by SQLite during busy callback) → cancel_tw.
310-
// The cancel path only acquires cancel_tw, never db->mutex, so no deadlock.
305+
// cannot be interrupted) with one that polls conn->cancelled between each
306+
// sqlite3_sleep() call. cancel() sets the flag and calls sqlite3_interrupt()
307+
// so disconnect() wakes within at most one sleep interval (~10ms).
311308
// ---------------------------------------------------------------------------
312309

313310
static int
@@ -1865,7 +1862,7 @@ exqlite_set_busy_timeout(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
18651862
}
18661863

18671864
/// Cancel: wake busy handler + interrupt VDBE.
1868-
/// Superset of interrupt/1: sets flag, signals condvar, calls sqlite3_interrupt().
1865+
/// Superset of interrupt/1: sets cancelled flag + calls sqlite3_interrupt().
18691866
///
18701867
ERL_NIF_TERM
18711868
exqlite_cancel(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])

lib/exqlite/connection.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ defmodule Exqlite.Connection do
212212
apply(state.before_disconnect, [err, state])
213213
end
214214

215-
# Cancel any in-flight query: wake the busy handler condvar AND interrupt
216-
# VDBE execution so close() doesn't block on conn->mutex.
215+
# Cancel any in-flight query: set the cancelled flag AND interrupt VDBE
216+
# execution so close() doesn't block on conn->mutex.
217217
# This is a superset of the old Sqlite3.interrupt(db) call.
218218
# See: https://github.com/elixir-sqlite/exqlite/issues/192
219219
Sqlite3.cancel(db)

0 commit comments

Comments
 (0)