Skip to content

Instantly share code, notes, and snippets.

@chrisber
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisber/16388792e6ead99fc0b0 to your computer and use it in GitHub Desktop.
Save chrisber/16388792e6ead99fc0b0 to your computer and use it in GitHub Desktop.
#v8dotnet segmentation fault
using System;
using System.IO;
using System.Threading;
using V8.Net;
namespace SegmentationFault
{
public class Alpha
{
// This method that will be called when the thread is started
public void Beta()
{ V8Engine v8 = new V8Engine();
String test = System.IO.File.ReadAllText ("/Build/Typescript/TypeScript/built/local/tsc.js");
while (true)
{
Console.WriteLine("Alpha.Beta is running in its own thread.");
}
}
}
class MainClass
{
public static void Main (string[] args)
{
//V8Engine v8 = new V8Engine();
Alpha oAlpha = new Alpha();
// Create the thread object, passing in the Alpha.Beta method
// via a ThreadStart delegate. This does not start the thread.
Thread oThread = new Thread(new ThreadStart(oAlpha.Beta));
// Start the thread
oThread.Start();
while (!oThread.IsAlive) {
}
Thread.Sleep(1);
try{
oThread.Abort();
}catch(Exception e){}
oThread.Join();
Console.WriteLine();
Console.WriteLine("Alpha.Beta has finished");
Console.WriteLine ("Hello World!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment