/// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public virtual void Dispose()
 {
     _engineFactory.DisposeEngineForCurrentThread();
     if (_engineFromPool.IsValueCreated)
     {
         _engineFactory.ReturnEngineToPool(_engineFromPool.Value);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Returns the currently held JS engine to the pool. (no-op if engine pooling is disabled)
 /// </summary>
 public void ReturnEngineToPool()
 {
     if (_engineFromPool.IsValueCreated)
     {
         _engineFactory.ReturnEngineToPool(_engineFromPool.Value);
         _engineFromPool = new Lazy <IJsEngine>(() => _engineFactory.GetEngine());
     }
 }