Rhino.Context.Exit C# (CSharp) Method

Exit() public static method

Exit a block of code requiring a Context.
Exit a block of code requiring a Context. Calling exit() will remove the association between the current thread and a Context if the prior call to ContextFactory.EnterContext() on this thread newly associated a Context with this thread. Once the current thread no longer has an associated Context, it cannot be used to execute JavaScript until it is again associated with a Context.
public static Exit ( ) : void
return void
		public static void Exit()
		{
			object helper = VMBridge.instance.GetThreadContextHelper();
			Rhino.Context cx = VMBridge.instance.GetContext(helper);
			if (cx == null)
			{
				throw new InvalidOperationException("Calling Context.exit without previous Context.enter");
			}
			if (cx.enterCount < 1)
			{
				Kit.CodeBug();
			}
			if (--cx.enterCount == 0)
			{
				VMBridge.instance.SetContext(helper, null);
				cx.factory.OnContextReleased(cx);
			}
		}
Context