Skip to content

Commit 8936b7b

Browse files
committed
fix: remove stale condvar references in comments
1 parent ec3381b commit 8936b7b

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
@@ -297,12 +297,9 @@ statement_release_lock(statement_t* statement)
297297
// Custom busy handler
298298
//
299299
// Replaces SQLite's default busy handler (which sleeps via sqlite3OsSleep and
300-
// cannot be interrupted) with one that waits on a condvar. This lets cancel()
301-
// signal the condvar and wake the handler immediately, so disconnect() can
302-
// proceed without waiting for the full busy_timeout.
303-
//
304-
// Lock ordering: db->mutex (held by SQLite during busy callback) → cancel_tw.
305-
// The cancel path only acquires cancel_tw, never db->mutex, so no deadlock.
300+
// cannot be interrupted) with one that polls conn->cancelled between each
301+
// sqlite3_sleep() call. cancel() sets the flag and calls sqlite3_interrupt()
302+
// so disconnect() wakes within at most one sleep interval (~10ms).
306303
// ---------------------------------------------------------------------------
307304

308305
static int
@@ -1665,7 +1662,7 @@ exqlite_set_busy_timeout(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
16651662
}
16661663

16671664
/// Cancel: wake busy handler + interrupt VDBE.
1668-
/// Superset of interrupt/1: sets flag, signals condvar, calls sqlite3_interrupt().
1665+
/// Superset of interrupt/1: sets cancelled flag + calls sqlite3_interrupt().
16691666
///
16701667
ERL_NIF_TERM
16711668
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)