Name

sqlite3_mutex_try() — Attempt to acquire a mutex lock

Definition

int sqlite3_mutex_try( sqlite3_mutex* mutex );
mutex

A mutual exclusion lock.

Returns

The value SQLITE_OK is returned if the lock was acquired. Otherwise, SQLITE_BUSY will be returned.

Description

This function attempts to acquire a mutual exclusion lock for the current thread. If the lock is acquired, SQLITE_OK will be returned. If the lock is held by another thread, SQLITE_BUSY will be returned. If a NULL mutex pointer is passed in, the function will return SQLITE_OK.

This function is not supported by all threading libraries. If SQLite has thread support, but this function is not supported, a valid mutex will always result in an SQLITE_BUSY return code.

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.