public void Start() { if (_engineInstance != null) { return; } _engineInstance = _jsEnginePool.GetInstance(); }
public void Stop() { if (_engineInstance == null) { throw new InvalidOperationException("Stop() cannot be called when the engine is not running"); } _jsEnginePool.ReleaseInstance(_engineInstance); _engineInstance = null; }
public void ReleaseInstance(JSEngineInstance instance) { instance.Clean(); Task.Run(() => _availableEngines.Enqueue(instance)); }