*** DRAFT ***

SQLite Requirement Matrix Details
mutex_alloc.html

Index Summary Markup Original


R-62139-20964-30258-06406-62558-17842-12310-23723 tcl slt th3 src

The sqlite3_mutex_alloc() routine allocates a new mutex and returns a pointer to it.

/* IMP: R-62139-20964 */
# EVIDENCE-OF: R-62139-20964 The sqlite3_mutex_alloc() routine allocates
# a new mutex and returns a pointer to it.

R-35945-11759-33348-59186-12007-55771-30323-25128 tcl slt th3 src

The sqlite3_mutex_alloc() routine returns NULL if it is unable to allocate the requested mutex.

/* IMP: R-35945-11759 */
# EVIDENCE-OF: R-35945-11759 The sqlite3_mutex_alloc() routine returns
# NULL if it is unable to allocate the requested mutex.

R-02445-31643-12462-38565-43200-47259-24553-56004 tcl slt th3 src

The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) cause sqlite3_mutex_alloc() to create a new mutex.

/* IMP: R-02445-31643 */
# EVIDENCE-OF: R-02445-31643 The first two constants (SQLITE_MUTEX_FAST
# and SQLITE_MUTEX_RECURSIVE) cause sqlite3_mutex_alloc() to create a
# new mutex.

R-31231-36717-57726-13439-19567-41766-26823-60811 tcl slt th3 src

The new mutex is recursive when SQLITE_MUTEX_RECURSIVE is used but not necessarily so when SQLITE_MUTEX_FAST is used.

/* IMP: R-31231-36717 */
# EVIDENCE-OF: R-31231-36717 The new mutex is recursive when
# SQLITE_MUTEX_RECURSIVE is used but not necessarily so when
# SQLITE_MUTEX_FAST is used.

R-15968-48708-39759-44208-63382-65413-21684-48201 tcl slt th3 src

The other allowed parameters to sqlite3_mutex_alloc() (anything other than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return a pointer to a static preexisting mutex.

/* IMP: R-15968-48708 */
# EVIDENCE-OF: R-15968-48708 The other allowed parameters to
# sqlite3_mutex_alloc() (anything other than SQLITE_MUTEX_FAST and
# SQLITE_MUTEX_RECURSIVE) each return a pointer to a static preexisting
# mutex.

R-34489-53953-36029-13063-60538-08284-18396-26034 tcl slt th3 src

Nine static mutexes are used by the current version of SQLite.

/* IMP: R-34489-53953 */
# EVIDENCE-OF: R-34489-53953 Nine static mutexes are used by the current
# version of SQLite.

R-22391-07186-37161-38876-45465-63159-33403-63078 tcl slt th3 src

Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() returns a different mutex on every call.

th3/cov1/mutex01.test:36   th3/cov1/mutex01.test:68

/* IMP: R-22391-07186 */
# EVIDENCE-OF: R-22391-07186 Note that if one of the dynamic mutex
# parameters (SQLITE_MUTEX_FAST or SQLITE_MUTEX_RECURSIVE) is used then
# sqlite3_mutex_alloc() returns a different mutex on every call.

R-10379-15557-17362-29530-27887-61401-49779-43037 tcl slt th3 src

For the static mutex types, the same mutex is returned on every call that has the same type number.

/* IMP: R-10379-15557 */
# EVIDENCE-OF: R-10379-15557 For the static mutex types, the same mutex
# is returned on every call that has the same type number.

R-43589-15127-43886-39082-32655-09009-64323-07852 tcl slt th3 src

The sqlite3_mutex_free() routine deallocates a previously allocated dynamic mutex.

/* IMP: R-43589-15127 */
# EVIDENCE-OF: R-43589-15127 The sqlite3_mutex_free() routine
# deallocates a previously allocated dynamic mutex.

R-14816-14138-45914-00386-55030-19688-47427-16370 tcl slt th3 src

The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt to enter a mutex.

/* IMP: R-14816-14138 */
# EVIDENCE-OF: R-14816-14138 The sqlite3_mutex_enter() and
# sqlite3_mutex_try() routines attempt to enter a mutex.

R-60813-08986-02359-37993-40551-24945-25887-06253 tcl slt th3 src

If another thread is already within the mutex, sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return SQLITE_BUSY.

/* IMP: R-60813-08986 */
# EVIDENCE-OF: R-60813-08986 If another thread is already within the
# mutex, sqlite3_mutex_enter() will block and sqlite3_mutex_try() will
# return SQLITE_BUSY.

R-60364-48303-16474-64960-19278-15379-28844-42689 tcl slt th3 src

The sqlite3_mutex_try() interface returns SQLITE_OK upon successful entry.

/* IMP: R-60364-48303 */
# EVIDENCE-OF: R-60364-48303 The sqlite3_mutex_try() interface returns
# SQLITE_OK upon successful entry.

R-07896-01909-17755-58747-61497-14681-53331-52466 tcl slt th3 src

Mutexes created using SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread. In such cases, the mutex must be exited an equal number of times before another thread can enter.

/* IMP: R-07896-01909 */
# EVIDENCE-OF: R-07896-01909 Mutexes created using
# SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same
# thread. In such cases, the mutex must be exited an equal number of
# times before another thread can enter.

R-20974-45876-55609-02198-26922-65375-59673-02037 tcl slt th3 src

Some systems (for example, Windows 95) do not support the operation implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() will always return SQLITE_BUSY. The SQLite core only ever uses sqlite3_mutex_try() as an optimization so this is acceptable behavior.

th3/th3mutex.c:167

/* IMP: R-20974-45876 */
# EVIDENCE-OF: R-20974-45876 Some systems (for example, Windows 95) do
# not support the operation implemented by sqlite3_mutex_try(). On those
# systems, sqlite3_mutex_try() will always return SQLITE_BUSY. The
# SQLite core only ever uses sqlite3_mutex_try() as an optimization so
# this is acceptable behavior.

R-39221-43493-49031-48260-11050-48204-23096-55403 tcl slt th3 src

The sqlite3_mutex_leave() routine exits a mutex that was previously entered by the same thread.

/* IMP: R-39221-43493 */
# EVIDENCE-OF: R-39221-43493 The sqlite3_mutex_leave() routine exits a
# mutex that was previously entered by the same thread.

R-29989-03153-00644-12353-52386-44408-44979-16456 tcl slt th3 src

If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or sqlite3_mutex_leave() is a NULL pointer, then all three routines behave as no-ops.

th3/cov1/mutex01.test:79

/* IMP: R-29989-03153 */
# EVIDENCE-OF: R-29989-03153 If the argument to sqlite3_mutex_enter(),
# sqlite3_mutex_try(), or sqlite3_mutex_leave() is a NULL pointer, then
# all three routines behave as no-ops.