Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
Loading...
Searching...
No Matches
Fork Set Management

Manage a collection of active forks for parallel evaluation. More...

Data Structures

struct  ParseForkSet
 A set of active forks being evaluated in parallel. More...
 

Functions

uint32_t parse_fork_set_active_count (const ParseForkSet *set)
 Return the number of forks still active.
 
bool parse_fork_set_add (ParseForkSet *set, ParseFork *fork)
 Add a fork to the set.
 
ParseForkparse_fork_set_best (const ParseForkSet *set)
 Find the best completed fork.
 
ParseForkSetparse_fork_set_create (uint32_t max_forks)
 Create a fork set with the given maximum fork count.
 
void parse_fork_set_destroy (ParseForkSet *set)
 Destroy a fork set and all forks it contains.
 
uint32_t parse_fork_set_prune (ParseForkSet *set)
 Remove and destroy all failed or abandoned forks.
 

Detailed Description

Manage a collection of active forks for parallel evaluation.

Function Documentation

◆ parse_fork_set_active_count()

uint32_t parse_fork_set_active_count ( const ParseForkSet set)

#include <include/parser_fork.h>

Return the number of forks still active.

Counts forks in FORK_PENDING or FORK_RUNNING state.

Parameters
setFork set to query.
Returns
Number of active forks.

◆ parse_fork_set_add()

bool parse_fork_set_add ( ParseForkSet set,
ParseFork fork 
)

#include <include/parser_fork.h>

Add a fork to the set.

The set takes ownership of the fork.

Parameters
setFork set to add to.
forkFork to add.
Return values
trueFork was added.
falseSet is at capacity.

◆ parse_fork_set_best()

ParseFork * parse_fork_set_best ( const ParseForkSet set)

#include <include/parser_fork.h>

Find the best completed fork.

Returns the fork with the lowest priority among those with FORK_COMPLETED status.

Parameters
setFork set to search.
Returns
Best completed fork, or NULL if no fork has completed.

◆ parse_fork_set_create()

ParseForkSet * parse_fork_set_create ( uint32_t  max_forks)

#include <include/parser_fork.h>

Create a fork set with the given maximum fork count.

Parameters
max_forksMaximum number of forks allowed (0 = unlimited).
Returns
New fork set, or NULL on allocation failure.
See also
parse_fork_set_destroy()

◆ parse_fork_set_destroy()

void parse_fork_set_destroy ( ParseForkSet set)

#include <include/parser_fork.h>

Destroy a fork set and all forks it contains.

Parameters
setFork set to destroy. Passing NULL is safe.

◆ parse_fork_set_prune()

uint32_t parse_fork_set_prune ( ParseForkSet set)

#include <include/parser_fork.h>

Remove and destroy all failed or abandoned forks.

Removes forks with FORK_FAILED or FORK_ABANDONED status.

Parameters
setFork set to prune.
Returns
Number of forks pruned.