Skip to content

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

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

Merged
merged 10 commits into from
Mar 13, 2025

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                                                                                                                                                                     |                                                                                                                                                    |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

@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
@bbrockbernd
Copy link
Collaborator Author

Bring back run() on both detailed and collapsed trace. On collapsed trace do show the direct children of run()

Copy link
Collaborator

@eupp eupp left a comment

Choose a reason for hiding this comment

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

As discussed with @ndkoval, let's do few changes:

  1. Leave top-leve run() but always expand it in both short and detailed trace.

@bbrockbernd bbrockbernd force-pushed the bbrockbernd/remove-result-for-custom-threads branch from 6c70471 to 6755979 Compare March 11, 2025 16:14
@bbrockbernd bbrockbernd requested a review from eupp March 11, 2025 16:15
@eupp eupp force-pushed the bbrockbernd/remove-result-for-custom-threads branch from 0406d34 to 2085428 Compare March 11, 2025 23:45
@eupp eupp force-pushed the bbrockbernd/remove-result-for-custom-threads branch from d9f2911 to 7794bb3 Compare March 12, 2025 19:51
@eupp eupp merged commit ca38c77 into develop Mar 13, 2025
20 checks passed
@eupp eupp deleted the bbrockbernd/remove-result-for-custom-threads branch March 13, 2025 09:31
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