Launch samples on a different thread than the launcher. Samples may install their own message loops and some operating systems do not behave correctly with multiple message loops on a single thread.

This commit is contained in:
the_fiddler 2009-11-16 10:56:07 +00:00
parent a8c0c7adf4
commit d5175d1d9c

View file

@ -32,6 +32,7 @@ using System.Drawing.Text;
using System.Reflection;
using System.Windows.Forms;
using OpenTK.Examples.Properties;
using System.Threading;
namespace Examples
{
@ -333,7 +334,11 @@ namespace Examples
}
Trace.WriteLine(String.Format("Launching sample: \"{0}\"", e.Attribute.Title));
Trace.WriteLine(String.Empty);
main.Invoke(null, null);
Thread thread = new Thread((ThreadStart)delegate { main.Invoke(null, null); });
thread.IsBackground = true;
thread.Start();
thread.Join();
}
catch (TargetInvocationException expt)
{