Esempio n. 1
0
        private static void RegisterSleepFunction(ExecutionConstrainedScript script, ManualResetEventSlim scriptThreadShutdownEvent)
        {
            script.Globals.Get("os").Table["sleep"] = (Action <double>)((double ms) =>
            {
                if (ms <= 0)
                {
                    throw ScriptRuntimeException.BadArgument(0, "sleep", "not a positive number");
                }

                scriptThreadShutdownEvent.Wait(TimeSpan.FromMilliseconds(ms));
            });
        }
Esempio n. 2
0
 public static void Register(ExecutionConstrainedScript script, ManualResetEventSlim scriptThreadShutdownEvent)
 {
     RegisterSleepFunction(script, scriptThreadShutdownEvent);
 }