Does Thread.new() work under Windows (10/11)?

In order to to attempt to port my alpha version of CrystApp to Windows, I was considering using the following pattern. Would it work under Windows?

  • If yes, what version of Crystal should I install on my Windows machine (where can I download it)?
  • If no, could starting two processes (instead of two coroutines or alternatively two threads) do the trick?
Thread.new do
  get "/" do
    "hello from kemal"
  end
  Kemal.run
end

wv = Webview.window(640, 480, Webview::SizeHints::NONE, "WebView with local webapp!", "http://localhost:3000")
wv.run
wv.destroy

Alternatively, would it be easier to cross-compile from Mac to Windows?

Thread is currently not a public API and using it is at your own risk. I think it should work on Windows, though.

Cross-compiling makes no difference in this matter.

1 Like