start method
Starts the runtime. Calling it more than once is a no-op.
Implementation
void start({int workerThreads = 0, int dispatchBatchMax = 64}) {
if (_started) return;
final callback = NativeCallable<b.wt_events_cb_tFunction>.listener(
_onBatch,
);
final config = calloc<b.wt_runtime_config_t>();
try {
config.ref
..struct_size = sizeOf<b.wt_runtime_config_t>()
..worker_threads = workerThreads
..dispatch_batch_max = dispatchBatchMax;
final status = b.wt_runtime_init(
config,
callback.nativeFunction,
nullptr,
);
if (status != b.wt_status_t.WT_OK) {
callback.close();
throw WebTransportException(
status.value,
'could not start the webtransport runtime',
operation: 'wt_runtime_init',
);
}
} finally {
calloc.free(config);
}
_callback = callback;
_started = true;
}