Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
Loading...
Searching...
No Matches
Hot-Swap Support

Atomically replace the active plugin and snapshot. More...

Functions

ParserManagerStatus parser_manager_hot_swap (ParserManager *mgr, LimePluginHandle new_handle, const char *grammar_file)
 Atomically replace the active plugin and snapshot.
 

Detailed Description

Atomically replace the active plugin and snapshot.

Function Documentation

◆ parser_manager_hot_swap()

ParserManagerStatus parser_manager_hot_swap ( ParserManager mgr,
LimePluginHandle  new_handle,
const char *  grammar_file 
)

#include <include/parser_manager.h>

Atomically replace the active plugin and snapshot.

Equivalent to parser_manager_set_active() but guarantees that the transition is atomic from the perspective of parser_manager_get_snapshot() callers. There is no window where get_snapshot() returns NULL or an intermediate state.

The old snapshot is released once all references to it are dropped (existing parse sessions keep their pinned references).

Parameters
mgrThe parser manager.
new_handleHandle of the plugin to activate.
grammar_fileGrammar file for create_snapshot(). May be NULL if a snapshot is already available.
Returns
PM_OK on success, or an error code.
See also
parser_manager_set_active()