Contains struct picotm_error and helper functions.
More...
#include <stdbool.h>
#include <stddef.h>
#include "compiler.h"
◆ picotm_error_code
Signals detected errors to picotm.
If a component detects an error, it should prefer setting the system- specific error code that was returned by the failed call. This is more specific than the generic one's below. In some portable code, such as the tm module, using the generic codes might be preferable.
Enumerator |
---|
PICOTM_GENERAL_ERROR | The exact error is unknown.
|
PICOTM_OUT_OF_MEMORY | Out-of-Memory error.
|
PICOTM_INVALID_FENV | Invalid floating-point environment.
|
◆ picotm_error_status
Signals error status to picotm.
Enumerator |
---|
PICOTM_CONFLICTING | Conflict among transactions detected.
|
PICOTM_REVOCABLE | Transaction requires irrevocability to continue.
|
PICOTM_ERROR_CODE | Error detected. Encoded as enum picotm_error_code .
|
PICOTM_ERRNO | Error detected. Encoded as errno code.
|
◆ picotm_error_clear()
Clears an error structure.
- Parameters
-
◆ picotm_error_get_description()
Returns an error's description.
- Parameters
-
- Returns
- The error description if set, or NULL otherwise.
◆ picotm_error_is_conflicting()
Tests if an error has been set to CONFLICTING status.
- Parameters
-
- Returns
- True if an error has been set to CONFLICTING, or false otherwise.
◆ picotm_error_is_error()
Tests if an error has been set to an error status.
- Parameters
-
- Returns
- True if an error has been set to an error status, or false otherwise.
◆ picotm_error_is_revocable()
Tests if an error has been set to REVOCABLE status.
- Parameters
-
- Returns
- True if an error has been set to REVOCABLE, or false otherwise.
◆ picotm_error_is_set()
Tests if an error has been set.
- Parameters
-
- Returns
- True if an error has been set, or false otherwise.
◆ picotm_error_mark_as_non_recoverable()
Marks an error as non-recoverable.
By default, errors are expected to recoverable. For irrevocable transactions or after applying events from the transaction log, errors cannot easily be recovered, because the program state is undefined in these situations. An errors that happens under such conditions is marked as being non-recoverable.
Normally, modules should not care baout this flag. The commit logic within picotm will set this flag if appropriate.
- Parameters
-
error | The error to mark as non-recoverable. |
◆ picotm_error_set_conflicting()
Sets an error of type PICOTM_CONFLICTING.
- Parameters
-
error | The error to set. |
conflicting_tx | The conflicting transaction if known, or NULL otherwise. |
◆ picotm_error_set_description()
Sets an error's description.
- Parameters
-
error | The error. |
description | A descriptive string. |
◆ picotm_error_set_errno()
Sets an error of type PICOTM_ERRNO.
- Parameters
-
error | The error to set. |
errno_hint | The errno code if known, or 0 otherwise. |
◆ picotm_error_set_error_code()
Sets an error of type PICOTM_ERROR_CODE.
- Parameters
-
error | The error to set. |
error_hint | The picotm error code if known, or PICOTM_GENERAL_ERROR otherwise. |
◆ picotm_error_set_revocable()
Sets an error of type PICOTM_REVOCABLE.
- Parameters
-