title: How to execute IronPython script in separate thread and then suspend it?
body: <p>Lets assume I have such code for testing.</p>
  
  <pre><code>public class SimpleScheduler
  {
      public Script Script { get; set; }
  
      private Thread _worker;
  
      public void Schedule()
      {
          this._worker = new Thread(this.Script.Execute);
          this._worker.Start();
      }
  
      public void Sleep()
      {
          //?
      }
  }
  </code></pre>
  
  <p><code>SimpleScheduler</code> just takes <code>Script</code> object and tries to execute it in separate thread.</p>
  
  <pre><code>    public class Script
      {
          public string ID { get; set; }
  
          private ScriptSource _scriptSource;
  
          private ScriptScope _scope;
  
          private CompiledCode _code;
  
          private string source = @"import clr
  clr.AddReference('Trampoline')
  from Trampoline import PythonCallBack
  def Start():
     PythonCallBack.Sleep()";
  
          public Script()
          {
              _scriptSource = IronPythonHelper.IronPythonEngine.CreateScriptSourceFromString(this.source);
              _scope = IronPythonHelper.IronPythonEngine.CreateScope();
              _code = _scriptSource.Compile();
          }
  
          public void Execute()
          {
              _code.Execute(_scope);
              dynamic start = _scope.GetVariable("Start");
              start();
          }
      }
  </code></pre>
  
  <p><code>Script</code> class tries to callback Sleep function of <code>PythonCallBack</code> class and wants to be suspended for some time.</p>
  
  <pre><code>public static class PythonCallBack
  {
      public static SimpleScheduler Scheduler;
  
      static PythonCallBack()
      {
          Scheduler = new SimpleScheduler();
      }
  
      public static void Sleep()
      {
          Scheduler.Sleep();
      }
  }
  </code></pre>
  
  <p>PythonCallBack just for calling sleep method of SimpleScheduler.</p>
  
  <p>Question:
  What is the best way to suspend thread, which executes Script? and then how to resume this thread execution?</p>