Skip to content
Permalink
Browse files

Made LustreCompiler thread-safe with HACK

  • Loading branch information...
pascalpfeil committed Jun 4, 2018
1 parent c11baff commit 4eb7098c2765c11ea0f711b794e9f9ae3f68213f
Showing with 8 additions and 2 deletions.
  1. +8 −2 Source/SafetyLustre.LustreCompiler/LustreCompiler.cs
@@ -17,6 +17,8 @@ namespace SafetyLustre.LustreCompiler
/// </summary>
public static class LusCompiler
{
private static readonly Object fileLock = new Object();

public static string Compile(string lustreSource, string mainNode)
{
SetupLus2Oc();
@@ -30,8 +32,12 @@ public static string Compile(string lustreSource, string mainNode)
wslHomeDirectory.Remove(0, 1) // Remove leading '/'
);

// Store luste source for lus2oc to read
File.WriteAllText(Path.Combine(lxssHomeDirectory, $"{mainNode}.lus"), lustreSource);
//HACK to make this thread safe
lock (fileLock)
{
// Store lustre source for lus2oc to read
File.WriteAllText(Path.Combine(lxssHomeDirectory, $"{mainNode}.lus"), lustreSource);
}

WslUtil.ExecuteCommand($"chmod 0777 {wslHomeDirectory}/{mainNode}.lus");

0 comments on commit 4eb7098

Please sign in to comment.
You can’t perform that action at this time.