Simple Virtual Machine A simple but flexible virtual machine

Functions
SVM synchronisation locks
SVM synchronisation

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] | svm | The 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

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | lock | The lock to acquire.
  [in] | soft | The 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when this API function is called outside a kernel.
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | lock | The lock to acquire.
  [in] | soft | The 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when this API function is called outside a kernel.
  FAILURE | interruption when this API function is called outside a waiting instruction.

See also
  svm_variable_delete
  svm_kernel_get_current
  svm_lock_new