Coder Social home page Coder Social logo

Comments (2)

rochus-keller avatar rochus-keller commented on September 4, 2024

I found the following:

  public class Test5 {
      private static void worker(object o) {
              System.Console.WriteLine("hello from worker");
      }
      
      static void begin() {
              System.Console.WriteLine("start test");
	          System.Threading.Thread t = new System.Threading.Thread(worker);
	          t.Start();
	          t.Join(); // hangs in join
              System.Console.WriteLine("end test");
      }
    	      
      static Test5()  {
	  // no effect: System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof (object).TypeHandle);
	  // no effect: begin();
             System.Console.WriteLine("start test");
	         System.Threading.Thread t = new System.Threading.Thread(worker);
	         t.Start();
	         t.Join(); // hangs in join
             System.Console.WriteLine("end test");
      }
  
  static void Main(string[] args)  {
	      /*
          System.Console.WriteLine("hello from Main");
          System.Console.WriteLine("start test");
	      System.Threading.Thread t = new System.Threading.Thread(worker);
	      t.Start();
	      t.Join(); // works
          System.Console.WriteLine("end test");
          */
      }
  }

This is a minimal C# application which is able to demonstrate the effect. Thread.Join() uses assumingly the same low-level function as bthread_wait(). If we call Join() in the static constructor the thread starts but doesn't run its body; so we aparently cannot use static constructors as the "begin" part of a module - the system doesn't seem to be working properly at this point.

from oberon.

rochus-keller avatar rochus-keller commented on September 4, 2024

Fixed with commit 18e7d0d; the issue was indeed related to the static constructor; apparently it is a bad idea to map Oberon module begin sections to static constructors; in the present case the thread system seems to be in an unknown state causing the strange observations. Since I moved module begin to a dedicated method called via import dependency chain NAppGUI threads work seamless with Mono.

The NAppGUI Fractals example now works fine on Linux and Windows when run from Mono. There is still an issue on macOS though; the NAppGUI app seems to hang in osmain just after window_show; will be traced in a separate issue.

from oberon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.