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

Custom threads: remove run(), remove lambda and remove result #557

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

bbrockbernd
Copy link
Collaborator

Cleans up representation of custom (user defined) threads.

  • Removes run()
  • Removes the two lines related to the lambda
  • Removes result
  • In collapsed trace shows root elements of the trace in the thread

Note: the root elements in the trace for custom threads still have at .....invoke() this should be fixed in the issue regarding lambdas.

Before:

Detailed trace:
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                                                                                                Thread 1                                                                                                |                                                                         Thread 2                                                                         |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SimpleThreadCreationRepresentationTest#1.block(): threw IllegalStateException at BaseRunConcurrentRepresentationTest$testRunWithModelChecker$result$1$1.invoke(RunConcurrentRepresentationTests.kt:40) |                                                                                                                                                          |
|   block(): threw IllegalStateException at SimpleThreadCreationRepresentationTest.block(ThreadCreationRepresentationTest.kt:39)                                                                         |                                                                                                                                                          |
|     thread(block = block$t1$1#1): Thread#2 at SimpleThreadCreationRepresentationTest.block(ThreadCreationRepresentationTest.kt:47)                                                                     |                                                                                                                                                          |
|     switch (reason: waiting for Thread 2 to finish)                                                                                                                                                    |                                                                                                                                                          |
|                                                                                                                                                                                                        | run()                                                                                                                                                    |
|                                                                                                                                                                                                        |   block$t1$1#1.invoke() at ThreadsKt$thread$thread$1.run(Thread.kt:30)                                                                                   |
|                                                                                                                                                                                                        |     invoke() at SimpleThreadCreationRepresentationTest$block$t1$1.invoke(ThreadCreationRepresentationTest.kt:47)                                         |
|                                                                                                                                                                                                        |       SimpleThreadCreationRepresentationTest#1.a ➜ 1 at SimpleThreadCreationRepresentationTest$block$t1$1.invoke(ThreadCreationRepresentationTest.kt:48) |
|                                                                                                                                                                                                        |       SimpleThreadCreationRepresentationTest#1.a = 2 at SimpleThreadCreationRepresentationTest$block$t1$1.invoke(ThreadCreationRepresentationTest.kt:48) |
|                                                                                                                                                                                                        |   result: void                                                                                                                                           |
|     Thread#2.join() at SimpleThreadCreationRepresentationTest.block(ThreadCreationRepresentationTest.kt:50)                                                                                            |                                                                                                                                                          |
|   result: IllegalStateException #1                                                                                                                                                                     |                                                                                                                                                          |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

After

Detailed trace:
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                                                                                                Thread 1                                                                                                |                                                                      Thread 2                                                                      |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SimpleThreadCreationRepresentationTest#1.block(): threw IllegalStateException at BaseRunConcurrentRepresentationTest$testRunWithModelChecker$result$1$1.invoke(RunConcurrentRepresentationTests.kt:40) |                                                                                                                                                    |
|   block(): threw IllegalStateException at SimpleThreadCreationRepresentationTest.block(ThreadCreationRepresentationTest.kt:39)                                                                         |                                                                                                                                                    |
|     thread(block = block$t1$1#1): Thread#2 at SimpleThreadCreationRepresentationTest.block(ThreadCreationRepresentationTest.kt:47)                                                                     |                                                                                                                                                    |
|     switch (reason: waiting for Thread 2 to finish)                                                                                                                                                    |                                                                                                                                                    |
|                                                                                                                                                                                                        | SimpleThreadCreationRepresentationTest#1.a ➜ 1 at SimpleThreadCreationRepresentationTest$block$t1$1.invoke(ThreadCreationRepresentationTest.kt:48) |
|                                                                                                                                                                                                        | SimpleThreadCreationRepresentationTest#1.a = 2 at SimpleThreadCreationRepresentationTest$block$t1$1.invoke(ThreadCreationRepresentationTest.kt:48) |
|     Thread#2.join() at SimpleThreadCreationRepresentationTest.block(ThreadCreationRepresentationTest.kt:50)                                                                                            |                                                                                                                                                    |
|   result: IllegalStateException #1                                                                                                                                                                     |                                                                                                                                                    |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

…ove double `invoke()` at start of threads. In the collapsed trace replace `run()` with the root nodes of the actor.
@bbrockbernd bbrockbernd requested a review from eupp March 5, 2025 09:22
@bbrockbernd bbrockbernd self-assigned this Mar 5, 2025
@bbrockbernd bbrockbernd linked an issue Mar 5, 2025 that may be closed by this pull request
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve representation of custom threads
2 participants