|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
A thread-safe cancellation token for C++ AVM simulation. More...
#include <cancellation_token.hpp>
Public Member Functions | |
| CancellationToken () | |
| CancellationToken (const CancellationToken &)=delete | |
| CancellationToken & | operator= (const CancellationToken &)=delete |
| CancellationToken (CancellationToken &&)=delete | |
| CancellationToken & | operator= (CancellationToken &&)=delete |
| void | cancel () |
| Signal cancellation. Called from TypeScript thread. | |
| bool | is_cancelled () const |
| Check if cancellation has been signaled. Called from C++ simulation thread. | |
| void | check_and_throw () const |
| Check and throw if cancelled. Called from C++ simulation thread. | |
Private Attributes | |
| std::atomic< bool > | cancelled_ |
A thread-safe cancellation token for C++ AVM simulation.
This token is used to signal cancellation from TypeScript to C++ when a simulation times out. The token is created in TypeScript, passed through NAPI, and checked periodically during C++ execution.
Usage:
Thread safety:
Definition at line 37 of file cancellation_token.hpp.
|
inline |
Definition at line 39 of file cancellation_token.hpp.
|
delete |
|
delete |
|
inline |
Signal cancellation. Called from TypeScript thread.
This is thread-safe and can be called while C++ simulation is running.
Definition at line 54 of file cancellation_token.hpp.
|
inline |
Check and throw if cancelled. Called from C++ simulation thread.
| CancelledException | if cancel() has been called |
Definition at line 68 of file cancellation_token.hpp.
|
inline |
Check if cancellation has been signaled. Called from C++ simulation thread.
Definition at line 61 of file cancellation_token.hpp.
|
delete |
|
delete |
|
private |
Definition at line 76 of file cancellation_token.hpp.