-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge our thread code back into std? #45
Comments
Priority and affinity are all we have to pass through. Surely this becomes problematic when thinking about third-party crates, but J guess it’s just another thing we can only worry our users not to do. Can we implement extensions on pre-existing std structs? |
From testing I can say: exactly that. Threads on a same priority seem to run in a very “preemptive” way. It probably just uses a random one from those available. |
Yeah, see for example https://doc.rust-lang.org/stable/std/os/unix/fs/trait.MetadataExt.html Edit: oh, maybe you meant outside of std. Yeah we could do that, but we wouldn't be able to modify how std's implementation works (ex. the pthread calls, or access the private fields) |
Ok, an |
I'm mostly through implementing this I think. Haven't tested it yet though 🙃. |
I noticed something about the test runner added in #41, which is that a panic in the single-threaded test runner pauses everything silently until the user presses SELECT (not ideal). This is due to a combination of the default I think running with threads would mostly resolve this, since the background thread panics would simply exit the threads as usual, but I'm open to other workarounds meanwhile if we'd rather keep the single-threaded behavior for now. |
We can just disable the handler with Edit: Or use the if cfg!(not(test)) && main_thread == thread::current().id() && console::Console::exists() {
// ...
} |
This is a good idea, and it works well enough, but doesn't behave very nicely if the |
We could technically work around this with a global boolean wrapped in a mutex, to signal if the tests have started or not. But that might be messy. |
We should work toward the |
Some context: #44
The text was updated successfully, but these errors were encountered: