libaramid
Portable Multiprocessing Library for C
|
libaramid public API header More...
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | TAG_ARMD_MemoryAllocator |
Abstract memory allocator. More... | |
struct | TAG_ARMD_Timespec |
struct | TAG_ARMD_LogElement |
Typedefs | |
typedef size_t | ARMD_Size |
Size type. | |
typedef int | ARMD_Bool |
Boolean type. | |
typedef double | ARMD_Real |
Floating point value type. | |
typedef uint64_t | ARMD_Handle |
Handle type. | |
typedef struct TAG_ARMD_Job | ARMD_Job |
Aramid Job. More... | |
typedef struct TAG_ARMD_Procedure | ARMD_Procedure |
Aramid Procedure. More... | |
typedef void *(* | ARMD_MemoryAllocatorAllocateFunc) (void *context, ARMD_Size size) |
Memory allocation function interface. More... | |
typedef void(* | ARMD_MemoryAllocatorFreeFunc) (void *context, void *buf) |
Memory free function interface. More... | |
typedef struct TAG_ARMD_MemoryAllocator | ARMD_MemoryAllocator |
Abstract memory allocator. More... | |
typedef struct TAG_ARMD_MemoryRegion | ARMD_MemoryRegion |
Memory region. More... | |
typedef struct TAG_ARMD_Context | ARMD_Context |
The execution engine. More... | |
typedef void(* | ARMD_PromiseCallbackFunc) (ARMD_Handle handle, void *callback_context, int has_error) |
Promise callback. More... | |
typedef enum TAG_ARMD_ContinuationResult | ARMD_ContinuationResult |
Continuation Status. | |
typedef ARMD_ContinuationResult(* | ARMD_ContinuationFunc) (ARMD_Job *job, const void *constants, void *args, void *frame, const void *continuation_constants, void *continuation_frame) |
Continuation Function. More... | |
typedef ARMD_ContinuationResult(* | ARMD_ErrorTrapFunc) (ARMD_Job *job, const void *constants, void *args, void *frame, const void *continuation_constants, void *continuation_frame) |
Error Trap Function. | |
typedef void(* | ARMD_ContinuationConstantsDestroyer) (ARMD_MemoryAllocator *memory_region, void *continuation_constants) |
Continuation Constant Destroyer. | |
typedef void *(* | ARMD_ContinuationFrameCreator) (ARMD_MemoryRegion *memory_region) |
Continuation Frame Creator. More... | |
typedef void(* | ARMD_ContinuationFrameDestroyer) (ARMD_MemoryRegion *memory_region, void *continuation_frame) |
Continuation Frame Destroyer. More... | |
typedef int(* | ARMD_SingleContinuationFunc) (ARMD_Job *job, const void *constants, void *args, void *frame) |
Single Continuation Function. More... | |
typedef ARMD_Size(* | ARMD_SequentialForCountFunc) (void *args, void *frame) |
Sequential-For Count Function. More... | |
typedef int(* | ARMD_SequentialForContinuationFunc) (ARMD_Job *job, const void *constants, void *args, void *frame, ARMD_Size index) |
Sequential-For Continuation Function. More... | |
typedef ARMD_Size(* | ARMD_ParallelForCountFunc) (void *args, void *frame) |
Parallel-For Count Function. More... | |
typedef int(* | ARMD_ParallelForContinuationFunc) (ARMD_Job *job, const void *constants, void *args, void *frame, ARMD_Size index) |
Parallel-For Continuation Function. More... | |
typedef ARMD_Bool(* | ARMD_SetupFunc) (ARMD_Job *job, const void *constants, void *args, void *frame, int dependency_has_error) |
Setup Function. More... | |
typedef void(* | ARMD_UnwindFunc) (ARMD_Job *job, const void *constants, void *args, void *frame) |
Unwind Function. More... | |
typedef struct TAG_ARMD_ProcedureBuilder | ARMD_ProcedureBuilder |
Builder object for ARMD_Procedure. | |
typedef struct TAG_ARMD_Timespec | ARMD_Timespec |
typedef enum TAG_ARMD_LogLevel | ARMD_LogLevel |
typedef struct TAG_ARMD_Logger | ARMD_Logger |
typedef struct TAG_ARMD_LogElement | ARMD_LogElement |
typedef void(* | ARMD_LoggerCallbackFunc) (void *context, ARMD_Logger *logger) |
Enumerations | |
enum | TAG_ARMD_ContinuationResult { ARMD_ContinuationResult_Error, ARMD_ContinuationResult_Ended, ARMD_ContinuationResult_Repeat } |
Continuation Status. | |
enum | TAG_ARMD_LogLevel { ARMD_LogLevel_Fatal, ARMD_LogLevel_Error, ARMD_LogLevel_Warn, ARMD_LogLevel_Info, ARMD_LogLevel_Debug, ARMD_LogLevel_Trace } |
Functions | |
ARMD_EXTERN_C void * | armd_memory_allocator_allocate (const ARMD_MemoryAllocator *allocator, ARMD_Size size) |
Allocates memory area with ARMD_MemoryAllocator. More... | |
ARMD_EXTERN_C void | armd_memory_allocator_free (const ARMD_MemoryAllocator *allocator, void *buf) |
Free memory area allocated with ARMD_MemoryAllocator. More... | |
ARMD_EXTERN_C void | armd_memory_allocator_init_default (ARMD_MemoryAllocator *memory_allocator) |
Initialize ARMD_MemoryAllocator with default value. More... | |
ARMD_EXTERN_C ARMD_MemoryRegion * | armd_memory_region_create (const ARMD_MemoryAllocator *memory_allocator) |
Create ARMD_MemoryRegion. More... | |
ARMD_EXTERN_C ARMD_Size | armd_memory_region_destroy (ARMD_MemoryRegion *memory_region) |
Destroy ARMD_MemoryRegion. More... | |
ARMD_EXTERN_C void * | armd_memory_region_allocate (ARMD_MemoryRegion *memory_region, ARMD_Size size) |
Allocates memory area with ARMD_MemoryRegion. More... | |
ARMD_EXTERN_C void | armd_memory_region_free (ARMD_MemoryRegion *memory_region, void *buf) |
Free memory area allocated with ARMD_MemoryRegion. More... | |
ARMD_EXTERN_C char * | armd_memory_region_strdup (ARMD_MemoryRegion *memory_region, const char *str) |
strdup for memory_region | |
ARMD_EXTERN_C ARMD_Context * | armd_context_create (const ARMD_MemoryAllocator *memory_allocator, ARMD_Size num_executors) |
Create ARMD_Context. More... | |
ARMD_EXTERN_C int | armd_context_destroy (ARMD_Context *context) |
Destroy ARMD_Context. More... | |
ARMD_EXTERN_C ARMD_Handle | armd_invoke (ARMD_Context *context, ARMD_Procedure *procedure, void *args, ARMD_Size num_dependencies, const ARMD_Handle *dependencies) |
Invoke procedure. More... | |
ARMD_EXTERN_C int | armd_await (ARMD_Context *context, ARMD_Handle handle) |
Await promise. More... | |
ARMD_EXTERN_C int | armd_detach (ARMD_Context *context, ARMD_Handle handle) |
Detach promise. More... | |
ARMD_EXTERN_C int | armd_await_all (ARMD_Context *context) |
Await all promise. | |
ARMD_EXTERN_C int | armd_add_promise_callback (ARMD_Context *context, ARMD_Handle handle, void *callback_context, ARMD_PromiseCallbackFunc callback_func) |
Add callback to the promise. More... | |
ARMD_EXTERN_C ARMD_Size | armd_job_get_num_executors (ARMD_Job *job) |
Get the number of executors in the ARMD_Context via ARMD_Job. More... | |
ARMD_EXTERN_C ARMD_Size | armd_job_get_executor_id (ARMD_Job *job) |
Get the executor id via ARMD_Job. More... | |
ARMD_EXTERN_C int | armd_fork (ARMD_Job *parent_job, ARMD_Procedure *procedure, void *args) |
Fork and invoke procedure. More... | |
ARMD_EXTERN_C int | armd_fork_with_id (ARMD_Size executor_id, ARMD_Job *parent_job, ARMD_Procedure *procedure, void *args) |
Fork and invoke procedure specifying the executor. More... | |
ARMD_EXTERN_C ARMD_ProcedureBuilder * | armd_procedure_builder_create (const ARMD_MemoryAllocator *memory_allocator, ARMD_Size constant_size, ARMD_Size frame_size) |
Create ARMD_ProcedureBuilder. More... | |
ARMD_EXTERN_C int | armd_procedure_builder_destroy (ARMD_ProcedureBuilder *procedure_builder) |
Destroy ARMD_ProcedureBuilder without building ARMD_Procedure. More... | |
ARMD_EXTERN_C ARMD_Procedure * | armd_procedure_builder_build_and_destroy (ARMD_ProcedureBuilder *procedure_builder) |
Build ARMD_Procedure and destroy ARMD_ProcedureBuilder. More... | |
ARMD_EXTERN_C void * | armd_procedure_builder_get_constants (ARMD_ProcedureBuilder *procedure_builder) |
Get the pointer to constant table. More... | |
ARMD_EXTERN_C ARMD_MemoryAllocator | armd_procedure_builder_get_memory_allocator (ARMD_ProcedureBuilder *procedure_builder) |
Get the memory allocator used in ARMD_ProcedureBuilder. More... | |
ARMD_EXTERN_C int | armd_then (ARMD_ProcedureBuilder *procedure_builder, ARMD_ContinuationFunc continuation_func, void *continuation_constants, ARMD_ContinuationConstantsDestroyer continuation_constants_destroyer, ARMD_ErrorTrapFunc error_trap_func, ARMD_ContinuationFrameCreator continuation_frame_creator, ARMD_ContinuationFrameDestroyer continuation_frame_destroyer) |
Appends a versatile continuation to the procedure. More... | |
ARMD_EXTERN_C int | armd_then_single (ARMD_ProcedureBuilder *procedure_builder, ARMD_SingleContinuationFunc single_continuation_func) |
Appends a single continuation to the procedure. More... | |
ARMD_EXTERN_C int | armd_then_sequential_for (ARMD_ProcedureBuilder *procedure_builder, ARMD_SequentialForCountFunc sequential_for_count_func, ARMD_SequentialForContinuationFunc sequential_for_continuation_func) |
Appends a sequential-for continuation to the procedure. More... | |
ARMD_EXTERN_C int | armd_then_parallel_for (ARMD_ProcedureBuilder *procedure_builder, ARMD_ParallelForCountFunc parallel_for_count_func, ARMD_ParallelForContinuationFunc parallel_for_continuation_func) |
Appends a parallel-for continuation to the procedure. | |
int | armd_setup (ARMD_ProcedureBuilder *builder, ARMD_SetupFunc setup_func) |
Add unwind callback to the procedure. More... | |
ARMD_EXTERN_C int | armd_unwind (ARMD_ProcedureBuilder *procedure_builder, ARMD_UnwindFunc unwind_func) |
Add unwind callback to the procedure. More... | |
ARMD_EXTERN_C int | armd_procedure_destroy (ARMD_Procedure *procedure) |
Destroy ARMD_Procedure. More... | |
ARMD_EXTERN_C void * | armd_procedure_get_constants (ARMD_Procedure *procedure) |
Get the pointer to constant table. More... | |
ARMD_EXTERN_C int | armd_get_time (ARMD_Timespec *result) |
ARMD_EXTERN_C char * | armd_format_time_iso8601 (ARMD_MemoryRegion *memory_region, const ARMD_Timespec *timespec) |
ARMD_EXTERN_C ARMD_Logger * | armd_logger_create (ARMD_MemoryRegion *memory_region, ARMD_LogLevel level) |
ARMD_EXTERN_C void | armd_logger_increment_reference_count (ARMD_Logger *logger) |
ARMD_EXTERN_C ARMD_Bool | armd_logger_decrement_reference_count (ARMD_Logger *logger) |
ARMD_EXTERN_C void | armd_logger_set_callback (ARMD_Logger *logger, ARMD_LoggerCallbackFunc callback_func, void *callback_context) |
ARMD_EXTERN_C void | armd_logger_set_stdout_callback (ARMD_Logger *logger) |
ARMD_EXTERN_C void | armd_logger_set_stderr_callback (ARMD_Logger *logger) |
ARMD_EXTERN_C ARMD_MemoryRegion * | armd_logger_get_memory_region (ARMD_Logger *logger) |
ARMD_EXTERN_C int | armd_logger_get_log_element (ARMD_Logger *logger, ARMD_LogElement **log_element) |
ARMD_EXTERN_C void | armd_logger_destroy_log_element (ARMD_Logger *logger, ARMD_LogElement *log_element) |
ARMD_EXTERN_C void | armd_logger_log_string (ARMD_Logger *logger, ARMD_LogLevel level, const char *filename, ARMD_Size lineno, char *message) |
ARMD_EXTERN_C void | armd_logger_log_format (ARMD_Logger *logger, ARMD_LogLevel level, const char *filename, ARMD_Size lineno, const char *format,...) ARMD_LOGGER_LOG_FORMAT_ATTRIBUTE |
libaramid public API header
#define armd_log_debug | ( | logger, | |
format, | |||
... | |||
) |
#define armd_log_error | ( | logger, | |
format, | |||
... | |||
) |
#define armd_log_fatal | ( | logger, | |
format, | |||
... | |||
) |
#define armd_log_info | ( | logger, | |
format, | |||
... | |||
) |
#define armd_log_trace | ( | logger, | |
format, | |||
... | |||
) |
#define armd_log_warn | ( | logger, | |
format, | |||
... | |||
) |
typedef struct TAG_ARMD_Context ARMD_Context |
The execution engine.
The global state for execution engine. It contains native threads, job deque, promise manager and so on. Most your API calls are done against this structure.
typedef void*(* ARMD_ContinuationFrameCreator) (ARMD_MemoryRegion *memory_region) |
Continuation Frame Creator.
This function allocates and initializes continuation frame.
memory_region | The memory region for the continuation frame to live in |
typedef void(* ARMD_ContinuationFrameDestroyer) (ARMD_MemoryRegion *memory_region, void *continuation_frame) |
Continuation Frame Destroyer.
This function allocates and initializes continuation frame.
memory_region | The memory region in which the continuation frame lives |
continuation_frame | The continuation frame to be freed |
typedef ARMD_ContinuationResult(* ARMD_ContinuationFunc) (ARMD_Job *job, const void *constants, void *args, void *frame, const void *continuation_constants, void *continuation_frame) |
Continuation Function.
This is something like functions but consists of many continuations which are represented with many fragment functions. The procedure also has meta infomation to execute in the thread pool.
typedef struct TAG_ARMD_Job ARMD_Job |
Aramid Job.
This is used when implementing ARMD_Procedure
typedef struct TAG_ARMD_MemoryAllocator ARMD_MemoryAllocator |
Abstract memory allocator.
It provides the capability of switching malloc implementation or injecting your own memory allocation algorithm. this struct is used not like a reference but like a value. That is, the members of ARMD_MemoryAllocator are copied into another ARMD_MemoryAllocator.
typedef void*(* ARMD_MemoryAllocatorAllocateFunc) (void *context, ARMD_Size size) |
Memory allocation function interface.
context | Memory allocator context. See ARMD_MemoryAllocator::context |
size | Allocation size in bytes. It can be zero but not recommended. |
typedef void(* ARMD_MemoryAllocatorFreeFunc) (void *context, void *buf) |
Memory free function interface.
context | Memory allocator context. See ARMD_MemoryAllocator::context |
buf | The pointer to free. It must be the same pointer returned by ARMD_MemoryAllocatorAllocateFunc, |
typedef struct TAG_ARMD_MemoryRegion ARMD_MemoryRegion |
Memory region.
It provides region-based memory management functionality. It is also called memory zone or arena in some projects. Memory areas allocated in the region can be freed in a batch or it enables to detect memory leakage in fine granularity. In contrast to ARMD_MemoryAllocator, this struct is used as a reference.
typedef int(* ARMD_ParallelForContinuationFunc) (ARMD_Job *job, const void *constants, void *args, void *frame, ARMD_Size index) |
Parallel-For Continuation Function.
The simplified continuation function to be used in armd_then_parallel_for. It omits continuation_constants and continuation_frame and it receives the repetition counter as Public API.
typedef ARMD_Size(* ARMD_ParallelForCountFunc) (void *args, void *frame) |
Parallel-For Count Function.
The delegate used to get the number of times to run repeatedly
typedef struct TAG_ARMD_Procedure ARMD_Procedure |
Aramid Procedure.
This is something like functions but consists of many continuations which are represented with many fragment functions. The procedure also has meta infomation to execute in the thread pool.
typedef void(* ARMD_PromiseCallbackFunc) (ARMD_Handle handle, void *callback_context, int has_error) |
Promise callback.
The function called when promise resolved. See armd_add_promise_callback.
typedef int(* ARMD_SequentialForContinuationFunc) (ARMD_Job *job, const void *constants, void *args, void *frame, ARMD_Size index) |
Sequential-For Continuation Function.
The simplified continuation function to be used in armd_then_sequential_for. It omits continuation_constants and continuation_frame and it receives the repetition counter as Public API.
typedef ARMD_Size(* ARMD_SequentialForCountFunc) (void *args, void *frame) |
Sequential-For Count Function.
The delegate used to get the number of times to run repeatedly
typedef ARMD_Bool(* ARMD_SetupFunc) (ARMD_Job *job, const void *constants, void *args, void *frame, int dependency_has_error) |
Setup Function.
The simplified continuation function to be used in armd_then_sequential_for. It omits continuation_constants and continuation_frame and it receives the repetition counter as Public API.
typedef int(* ARMD_SingleContinuationFunc) (ARMD_Job *job, const void *constants, void *args, void *frame) |
Single Continuation Function.
The simplified continuation function to be used in armd_then_single. It omits continuation_constants, continuation_frame, and the ability to run repeatedly.
typedef void(* ARMD_UnwindFunc) (ARMD_Job *job, const void *constants, void *args, void *frame) |
Unwind Function.
The simplified continuation function to be used in armd_then_sequential_for. It omits continuation_constants and continuation_frame and it receives the repetition counter as Public API.
ARMD_EXTERN_C int armd_add_promise_callback | ( | ARMD_Context * | context, |
ARMD_Handle | handle, | ||
void * | callback_context, | ||
ARMD_PromiseCallbackFunc | callback_func | ||
) |
Add callback to the promise.
Add a function to be called when the promise being resolved. Note that the thread which invokes the callback is not indeterminate and the promise_callback may be invoked immediately. Many API in libaramid is not reentrant. If you calls any API of libaramid in this callback, a deadlock may occur.
ARMD_EXTERN_C int armd_await | ( | ARMD_Context * | context, |
ARMD_Handle | handle | ||
) |
Await promise.
This function locks the caller thread and it will not return until the promise is completed.
context | The ARMD_Context which promise belongs to |
handle | The ARMD_Handle of the promise to be awaited |
ARMD_EXTERN_C ARMD_Context* armd_context_create | ( | const ARMD_MemoryAllocator * | memory_allocator, |
ARMD_Size | num_executors | ||
) |
Create ARMD_Context.
memory_allocator | The memory allocator used everywhere related to this context |
num_executors | The number of executors, in other words, concurrency |
ARMD_EXTERN_C int armd_context_destroy | ( | ARMD_Context * | context | ) |
Destroy ARMD_Context.
context | The ARMD_Context to destroy |
ARMD_EXTERN_C int armd_detach | ( | ARMD_Context * | context, |
ARMD_Handle | handle | ||
) |
Detach promise.
This function detaches the job.
context | The ARMD_Context which promise belongs to |
handle | The ARMD_Handle of the promise to be detached |
ARMD_EXTERN_C int armd_fork | ( | ARMD_Job * | parent_job, |
ARMD_Procedure * | procedure, | ||
void * | args | ||
) |
Fork and invoke procedure.
This function forks the thread of execution and invoke the procedure in it. The new job is queued into the current executor. Note that the job created by this API is reassigned to another executor by work-stealing system.
parent_job | The current ARMD_Job |
procedure | The ARMD_Procedure to run |
args | The arguments to pass into ARMD_Procedure |
ARMD_EXTERN_C int armd_fork_with_id | ( | ARMD_Size | executor_id, |
ARMD_Job * | parent_job, | ||
ARMD_Procedure * | procedure, | ||
void * | args | ||
) |
Fork and invoke procedure specifying the executor.
This function forks the thread of execution and invoke the procedure in it. The new job is queued into the executor specified with executor_id. Note that the job created by this API is reassigned to another executor by work-stealing system.
executor_id | The id of executor to run procedure in |
parent_job | The current ARMD_Job |
procedure | The ARMD_Procedure to run |
args | The arguments to pass into ARMD_Procedure |
ARMD_EXTERN_C ARMD_Handle armd_invoke | ( | ARMD_Context * | context, |
ARMD_Procedure * | procedure, | ||
void * | args, | ||
ARMD_Size | num_dependencies, | ||
const ARMD_Handle * | dependencies | ||
) |
Invoke procedure.
context | The ARMD_Context to run the procedure in |
procedure | The ARMD_Procedure to run |
args | The arguments to pass into ARMD_Procedure |
num_dependencies | The number of elements in dependencies |
dependencies | The array of handles of dependent promises, this should be a valid pointer even if num_dependencies == 0 |
Get the executor id via ARMD_Job.
This function returns the id of executors which is running the job. This is useful for implementing your ARMD_Procedure.
job | The current ARMD_Job |
Get the number of executors in the ARMD_Context via ARMD_Job.
This function returns the number of executors in the ARMD_Context which the job belongs to. This is useful for implementing your ARMD_Procedure.
job | The current ARMD_Job |
ARMD_EXTERN_C void* armd_memory_allocator_allocate | ( | const ARMD_MemoryAllocator * | allocator, |
ARMD_Size | size | ||
) |
Allocates memory area with ARMD_MemoryAllocator.
allocator | The memory allocator |
size | Allocation size in bytes. It can be zero but not recommended. |
ARMD_EXTERN_C void armd_memory_allocator_free | ( | const ARMD_MemoryAllocator * | allocator, |
void * | buf | ||
) |
Free memory area allocated with ARMD_MemoryAllocator.
allocator | The memory allocator. It must be the same allocator used on allocation. |
buf | The pointer to free. It must be the same pointer returned by armd_memory_allocator_allocate. |
ARMD_EXTERN_C void armd_memory_allocator_init_default | ( | ARMD_MemoryAllocator * | memory_allocator | ) |
Initialize ARMD_MemoryAllocator with default value.
It initializes ARMD_MemoryAllocator to use the system's malloc and free from stdlib.h
memory_allocator | The memory allocator to initialize |
ARMD_EXTERN_C void* armd_memory_region_allocate | ( | ARMD_MemoryRegion * | memory_region, |
ARMD_Size | size | ||
) |
Allocates memory area with ARMD_MemoryRegion.
allocator | The memory region |
size | Allocation size in bytes. It can be zero but not recommended. |
ARMD_EXTERN_C ARMD_MemoryRegion* armd_memory_region_create | ( | const ARMD_MemoryAllocator * | memory_allocator | ) |
Create ARMD_MemoryRegion.
memory_allocator | The memory allocator to use |
ARMD_EXTERN_C ARMD_Size armd_memory_region_destroy | ( | ARMD_MemoryRegion * | memory_region | ) |
Destroy ARMD_MemoryRegion.
memory_region | The memory region to destroy |
ARMD_EXTERN_C void armd_memory_region_free | ( | ARMD_MemoryRegion * | memory_region, |
void * | buf | ||
) |
Free memory area allocated with ARMD_MemoryRegion.
allocator | The memory region. It must be the same region used on allocation. |
buf | The pointer to free. It must be the same pointer returned by armd_memory_region_allocate. |
ARMD_EXTERN_C ARMD_Procedure* armd_procedure_builder_build_and_destroy | ( | ARMD_ProcedureBuilder * | procedure_builder | ) |
Build ARMD_Procedure and destroy ARMD_ProcedureBuilder.
procedure_builder | The procedure builder to build and destroy |
ARMD_EXTERN_C ARMD_ProcedureBuilder* armd_procedure_builder_create | ( | const ARMD_MemoryAllocator * | memory_allocator, |
ARMD_Size | constant_size, | ||
ARMD_Size | frame_size | ||
) |
Create ARMD_ProcedureBuilder.
memory_allocator | The memory allocator to use |
constant_size | The size of constant table |
frame_size | The size of frame |
ARMD_EXTERN_C int armd_procedure_builder_destroy | ( | ARMD_ProcedureBuilder * | procedure_builder | ) |
Destroy ARMD_ProcedureBuilder without building ARMD_Procedure.
procedure_builder | The procedure builder to destroy |
ARMD_EXTERN_C void* armd_procedure_builder_get_constants | ( | ARMD_ProcedureBuilder * | procedure_builder | ) |
Get the pointer to constant table.
procedure_builder | The procedure builder |
ARMD_EXTERN_C ARMD_MemoryAllocator armd_procedure_builder_get_memory_allocator | ( | ARMD_ProcedureBuilder * | procedure_builder | ) |
Get the memory allocator used in ARMD_ProcedureBuilder.
procedure_builder | The procedure builder |
ARMD_EXTERN_C int armd_procedure_destroy | ( | ARMD_Procedure * | procedure | ) |
Destroy ARMD_Procedure.
memory_region | The procedure to destroy |
ARMD_EXTERN_C void* armd_procedure_get_constants | ( | ARMD_Procedure * | procedure | ) |
Get the pointer to constant table.
procedure | The procedure |
int armd_setup | ( | ARMD_ProcedureBuilder * | builder, |
ARMD_SetupFunc | setup_func | ||
) |
Add unwind callback to the procedure.
Adds the unwind callback to the procedure. The unwind callback is called when procedures exit independent of the execution status.
ARMD_EXTERN_C int armd_then | ( | ARMD_ProcedureBuilder * | procedure_builder, |
ARMD_ContinuationFunc | continuation_func, | ||
void * | continuation_constants, | ||
ARMD_ContinuationConstantsDestroyer | continuation_constants_destroyer, | ||
ARMD_ErrorTrapFunc | error_trap_func, | ||
ARMD_ContinuationFrameCreator | continuation_frame_creator, | ||
ARMD_ContinuationFrameDestroyer | continuation_frame_destroyer | ||
) |
Appends a versatile continuation to the procedure.
The versatile API to add the new continuation at last of the continuation sequence in ARMD_ProcedureBuilder. You should not use this function unless you are implementing scheduling function. armd_then_single and armd_then_sequential_for is much simpler and enough.
ARMD_EXTERN_C int armd_then_sequential_for | ( | ARMD_ProcedureBuilder * | procedure_builder, |
ARMD_SequentialForCountFunc | sequential_for_count_func, | ||
ARMD_SequentialForContinuationFunc | sequential_for_continuation_func | ||
) |
Appends a sequential-for continuation to the procedure.
Adds a sequential-for continuation at last of the continuation sequence in ARMD_ProcedureBuilder. A sequential-for continuation sequential_for_continuation_func is called repeatedly several times specified by sequential_for_count_func.
ARMD_EXTERN_C int armd_then_single | ( | ARMD_ProcedureBuilder * | procedure_builder, |
ARMD_SingleContinuationFunc | single_continuation_func | ||
) |
Appends a single continuation to the procedure.
Adds a single continuation at last of the continuation sequence in ARMD_ProcedureBuilder. A single continuation is simply called once per invocation.
ARMD_EXTERN_C int armd_unwind | ( | ARMD_ProcedureBuilder * | procedure_builder, |
ARMD_UnwindFunc | unwind_func | ||
) |
Add unwind callback to the procedure.
Adds the unwind callback to the procedure. The unwind callback is called when procedures exit independent of the execution status.