Browse Source

Added a mechanism for external code to block the pass for finding symbols.

It's useful when waiting for new symbols, such as inlines and templates, to be compiled.
pull/742/head
Dimitar Dobrev 9 years ago
parent
commit
fc55c7ed09
  1. 34
      src/Generator/Passes/FindSymbolsPass.cs

34
src/Generator/Passes/FindSymbolsPass.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
using CppSharp.AST;
using System.Threading;
using CppSharp.AST;
namespace CppSharp.Passes
{
@ -16,6 +17,34 @@ namespace CppSharp.Passes @@ -16,6 +17,34 @@ namespace CppSharp.Passes
VisitOptions.VisitClassFields = false;
}
public bool Wait
{
get { return wait; }
set
{
if (wait != value)
{
wait = value;
if (!wait)
{
manualResetEvent.Set();
manualResetEvent.Dispose();
manualResetEvent = null;
}
}
}
}
public override bool VisitASTContext(ASTContext context)
{
if (Wait)
{
manualResetEvent = new ManualResetEvent(false);
manualResetEvent.WaitOne();
}
return base.VisitASTContext(context);
}
public override bool VisitDeclaration(Declaration decl)
{
if (!base.VisitDeclaration(decl))
@ -52,5 +81,8 @@ namespace CppSharp.Passes @@ -52,5 +81,8 @@ namespace CppSharp.Passes
mangledDecl.Mangled = symbol;
return true;
}
private bool wait;
private ManualResetEvent manualResetEvent;
}
}

Loading…
Cancel
Save