Skip to content
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

Support Scala Native multithreading #861

Merged
merged 3 commits into from
Dec 17, 2024

Conversation

WojciechMazur
Copy link
Contributor

Since Scala Native 0.5.0 we have access to multithreading support, it's enabled by default if we detect usage of threading in the compiled code. This change does acknowledge multihreading support in PlatformCompat for Native (mostly copy-paste based on JVM implementation with minor changes)

Additional changes required to unsupress Issue285FrameworkSuite:

  • Don't print stacktrace of the uncought exception - it's not reported on the JVM. Make the outputs of JVM and JS/Native compliant
  • Handle optional possible extra space before <elapsed time> pattern - it is sometimes produced by the JVM
  • Print elapased time milliseconds using 3 digits instead of 2 (to follow JVM semantics)

… print stack trace of exceptions and acknoledge optional space before elapsed time on the JVM
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@tgodzik tgodzik merged commit 19fe2f6 into scalameta:main Dec 17, 2024
9 checks passed
@WojciechMazur WojciechMazur deleted the scala-native/multithreading branch December 17, 2024 10:50
Thread.sleep(ms)
body
if (!isMultithreadingEnabled) {
// Thread.sleep(ms)
Copy link
Collaborator

@valencik valencik Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WojciechMazur
Why was this added but commented out?
Now it looks like if multithreading is disabled we ignore timeout durations and run body immediately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what's the story of original Thread.sleep call but it makes no sense to have it. The goal of this method was to introduce timeouts, instead it was only slowing the execution, while there was nothing else running in the background.

@valencik
Copy link
Collaborator

valencik commented Jan 3, 2025

@WojciechMazur do we have an idea of what kind of issues this should fix?

And ultimately, should we cut a new release with these changes?

@WojciechMazur
Copy link
Contributor Author

@WojciechMazur do we have an idea of what kind of issues this should fix?

It would mostly allow to have the same semantics as when execution on the JVM. Can potentially also fix some issues in the async tests due to incorrect behaviour of waitAtMost and setTimeout methods.

The new release would be welcome, probably can be made as a patch

@tgodzik
Copy link
Contributor

tgodzik commented Jan 7, 2025

Running the release https://github.com/scalameta/munit/releases/tag/v1.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants