|
| typedef int(* | KSI_Lock_cb) (int mode, int n, const char *file, int line) |
| |
The SDK does not implicitly support multithreading as this is not a standard functionality in c. However, as long as the user does not share contexts between threads, the user can define custom locking functionality.
The number of required locks can be aquired by calling KSI_LOCK_count function.
◆ KSI_LOCK
◆ KSI_UNLOCK
◆ KSI_Lock_cb
| typedef int(* KSI_Lock_cb) (int mode, int n, const char *file, int line) |
Mutex locking callback function type.
- Parameters
-
| [in] | mode | Bit map combined of the enum KSI_LockMode_en. |
| [in] | n | The number of the lock (KSI_Lock_en). |
| [in] | file | Filename where the call was made. |
| [in] | line | The line number in the file where the call was made. |
- Returns
- KSI_OK when successful.
◆ KSI_Lock_en
| Enumerator |
|---|
| KSI_MUTEX_GLOBALS | |
| KSI_MUTEX_TRANSPORT | |
| KSI_MUTEX_HASHING | |
| KSI_MUTEX_CRYPTO | |
| __KSI_NUMBER_OF_LOCKS | |
◆ KSI_LockMode_en
| Enumerator |
|---|
| KSI_LOCK_ON | |
| KSI_LOCK_OFF | |
◆ KSI_LOCK_count()
Returns the number of locks required.
- Note
- The return value is not guarenteed to be equal to __KSI_NUMBER_OF_LOCKS.
◆ KSI_LOCK_set()
| int KSI_LOCK_set |
( |
int |
mode, |
|
|
int |
n, |
|
|
const char * |
file, |
|
|
int |
line |
|
) |
| |
Calls the callback with the given arguments. If callback is not set, the function does nothing.
- See also
- KSI_Lock_cb.
◆ KSI_LOCK_setCallback()
Sets the locking callback function, where the mode is a bit vector combined of the enum KSI_LockMode_en; n is one of the KSI_Lock_en values; file and line are used for debugging and indicates where the lock was issued from. The callback function must free the lock
iff (mode & KSI_LOCK_OFF) == 1.
- Parameters
-
| [in] | cb | Callback to be called when a mutex is locked or unlocked. |