Simple Virtual Machine A simple but flexible virtual machine

Functions
SVM process execution
SVM processes

This module contains API functions to handle SVM process execution. More...

## Functions
SVM_FUNCTION void | svm_process_run (const void *svm, const SVM_Process process, const SVM_Value_Integer delay)
| This function requires the execution of a process with a delay as an integer value. More...
SVM_FUNCTION void | svm_process_run__raw (const void *svm, const SVM_Process process, const unsigned long int delay)
| This function requires the execution of a process with a delay as an raw integer. More...
SVM_FUNCTION void | svm_process_suspend (const void *svm, const SVM_Process process)
| This function requests the suspension of a process. More...
SVM_FUNCTION void | svm_process_terminate (const void *svm, const SVM_Process process)
| This function requests the terminaison of a process. More...
SVM_FUNCTION void | svm_process_interrupt (const void *svm, const SVM_Process process, const SVM_Value_Interruption interruption)
| This function requests the interruption of a process. More...
SVM_FUNCTION void | svm_process_pause (const void *svm)
| This function changes the current process status to notify it enters in a blocking wait inside an instruction. More...
SVM_FUNCTION void | svm_process_resume (const void *svm)
| This function changes the current process status to notify it exits a blocking wait inside an instruction. More...

## Detailed Description

This module contains API functions to handle SVM process execution.

## Function Documentation

## ◆ svm_process_interrupt()

SVM_FUNCTION void svm_process_interrupt | ( | const void * | svm,
|  | const SVM_Process | process,
|  | const SVM_Value_Interruption | interruption
| ) |  |

This function requests the interruption of a process.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | process | The process to interrupt.
  [in] | interruption | The interruption to use for process interruption.

The process does need to be locked by us.

Note
  The interruption of the process is asynchronous, and it will be interrupted once the interruption request reaches the process.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)

## ◆ svm_process_pause()

SVM_FUNCTION void svm_process_pause | ( | const void * | svm | ) |

This function changes the current process status to notify it enters in a blocking wait inside an instruction.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.

The process status is changed to WAITING and a notification is sent to its scheduler.

Note
  If the instruction execution is reached before a call to svm_process_resume, the process is automatically resumed before the next instruction execution.

An example of a proper implementation of a pause in the current process could be:

svm_process_pause(svm); // Current process notifies the start of the pause
// Code waiting for an external condition
svm_process_resume(svm); // Current process notifies the end of the pause
svm_process_pause
SVM_FUNCTION void svm_process_pause(const void *svm)
This function changes the current process status to notify it enters in a blocking wait inside an ins...
svm_process_resume
SVM_FUNCTION void svm_process_resume(const void *svm)
This function changes the current process status to notify it exits a blocking wait inside an instruc...

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 waiting instruction.

See also
  svm_process_resume

## ◆ svm_process_resume()

SVM_FUNCTION void svm_process_resume | ( | const void * | svm | ) |

This function changes the current process status to notify it exits a blocking wait inside an instruction.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.

The process status is changed to CONTINUE and a notification is sent to its scheduler. The process waits for the execution restart triggered by the scheduler. The process status is changed to RUNNING and a notification is sent to its scheduler.

Note
  Other events received by the process while waiting for the execution request are postponed, usually at the end of the execution of the current instruction.

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 waiting instruction.

See also
  svm_process_pause

## ◆ svm_process_run()

SVM_FUNCTION void svm_process_run | ( | const void * | svm,
|  | const SVM_Process | process,
|  | const SVM_Value_Integer | delay
| ) |  |

This function requires the execution of a process with a delay as an integer value.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | process | The process to run.
  [in] | delay | The delay before the process replies when locked.

The process does need to be locked by us.

Note
  The execution of the process is asynchronous, and it will start run once the execution request reached the process.

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 from a process.

## ◆ svm_process_run__raw()

SVM_FUNCTION void svm_process_run__raw | ( | const void * | svm,
|  | const SVM_Process | process,
|  | const unsigned long int | delay
| ) |  |

This function requires the execution of a process with a delay as an raw integer.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | process | The process to run.
  [in] | delay | The delay before the process replies when locked.

The process does need to be locked by us.

Note
  The execution of the process is asynchronous, and it will start run once the execution request reaches the process.

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 from a process.

## ◆ svm_process_suspend()

SVM_FUNCTION void svm_process_suspend | ( | const void * | svm,
|  | const SVM_Process | process
| ) |  |

This function requests the suspension of a process.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | process | The process to suspend.

The process does need to be locked by us.

Note
  The suspension of the process is asynchronous, and it will be suspension once the suspension request reaches the process.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)

## ◆ svm_process_terminate()

SVM_FUNCTION void svm_process_terminate | ( | const void * | svm,
|  | const SVM_Process | process
| ) |  |

This function requests the terminaison of a process.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | process | The process to terminate.

The process does need to be locked by us.

Note
  The terminaison of the process is asynchronous, and it will be terminated once the terminaison request reaches the process.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)