Simple Virtual Machine
A simple but flexible virtual machine
SVM synchronisation locks

This module contains API functions to handle SVM synchronisation locks. More...

Functions

SVM_FUNCTION SVM_Lock svm_lock_new (const void *svm)
 This function creates a lock. More...
 
SVM_FUNCTION SVM_LockGuard_Read svm_lock_readguard_new (const void *svm, const SVM_Lock lock, const SVM_Boolean soft)
 This function locks a lock for read access. More...
 
SVM_FUNCTION SVM_LockGuard_Write svm_lock_writeguard_new (const void *svm, const SVM_Lock lock, const SVM_Boolean soft)
 This function locks a lock for write access. More...
 

Detailed Description

This module contains API functions to handle SVM synchronisation locks.

Function Documentation

◆ svm_lock_new()

SVM_FUNCTION SVM_Lock svm_lock_new ( const void *  svm)

This function creates a lock.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.

This lock supports the mutual exclusion of one writer and several concurent readers.

Note
The lock will be kept alive while either a variable or a read lock guard or a write lock guard exists on this lock.
Returns
The lock. This lock can be acquired by the API functions svm_lock_readguard_new and svm_lock_writeguard_new.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
See also
svm_lock_readguard_new
svm_lock_writeguard_new

◆ svm_lock_readguard_new()

SVM_FUNCTION SVM_LockGuard_Read svm_lock_readguard_new ( const void *  svm,
const SVM_Lock  lock,
const SVM_Boolean  soft 
)

This function locks a lock for read access.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]lockThe lock to acquire.
[in]softThe process is put in pause while waiting for the lock acquisition.

The lock is acquired for read access until the returned lock guard is freed/deleted. Please refer to the svm_variable_delete API function.

Returns
A read lock guard on the acquired lock.
Note
The soft parameter shall be set to FALSE when the lock is used at least once inside a scheduler, and should be set to TRUE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when this API function is called outside a kernel.
FAILUREinterruption when this API function is called outside a waiting instruction.
See also
svm_variable_delete
svm_kernel_get_current
svm_lock_new

◆ svm_lock_writeguard_new()

SVM_FUNCTION SVM_LockGuard_Write svm_lock_writeguard_new ( const void *  svm,
const SVM_Lock  lock,
const SVM_Boolean  soft 
)

This function locks a lock for write access.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]lockThe lock to acquire.
[in]softThe process is put in pause while waiting for the lock acquisition.

The lock is acquired for write access until the returned lock guard is freed/deleted. Please refer to the svm_variable_delete API function.

Returns
A write lock guard on the acquired lock.
Note
The soft parameter shall be set to FALSE when the lock is used at least once inside a scheduler, and should be set to TRUE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when this API function is called outside a kernel.
FAILUREinterruption when this API function is called outside a waiting instruction.
See also
svm_variable_delete
svm_kernel_get_current
svm_lock_new