Implement multithreading primitives on Windows#11647
Conversation
| thrdaddr: Pointer(LibC::UInt).null) | ||
|
|
||
| if @th.null? | ||
| raise RuntimeError.from_errno("_beginthreadex") |
There was a problem hiding this comment.
Hmm, raising on null both here and in beginthreadex seems a bit redundant.
beta-ziliani
left a comment
There was a problem hiding this comment.
The Windows job is failing, can you run tests locally?
| thrdaddr: Pointer(LibC::UInt).null) | ||
|
|
||
| if @th.null? | ||
| raise RuntimeError.from_errno("_beginthreadex") |
|
I cannot reproduce the CI failure locally; the same |
|
It seems Windows CI is working again, all that's left is fixing the WASI one. |
Co-authored-by: Johannes Müller <[email protected]>
|
After countless pushes I have identified that |
This enables the fiber-safe `Mutex` on Windows and removes the stub implementation. It is mostly unrelated to [`Thread::Mutex`](#11647). The standard library uses `Mutex` in `Log::SyncDispatcher`; it does not seem to break. (On the other hand, the specs for `Log::AsyncDispatcher` require non-blocking pipes, which are not available yet.)
|
FTR: This needed work because CI previously failed, despite working locally. Now CI was green and I considered it ready to be merged. |
Adds Win32 bindings for
Thread,Thread::Mutex, andThread::ConditionVariable. They represent system threads, so they should work independently from concurrency features, even without-Dpreview_mt. (Why aren't they namespaced underCrystal::Systemif they are internal platform-dependent types...?)Related: #5430