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

Don't set thread name on main thread #1329

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

msimberg
Copy link
Contributor

#1290 set the pthread name for all threads that are used by pika, including the main thread. Since we don't create or "own" the main thread, this PR removes setting the name for the main thread. E.g. in GDB the main thread will simply inherit the name of the binary, which I think is a lot more accurate.

For example, hello_world in pika_main:

(gdb) info threads
  Id   Target Id                                        Frame
  1    Thread 0x7ffff4efb9c0 (LWP 711869) "hello_world" 0x00007ffff4b1739d in __clone3 () from /nix/store/3bvxjkkmwlymr0fssczhgi39c3aj1l7i-glibc-2.40-36/lib/libc.so.6
  2    Thread 0x7ffff14ff6c0 (LWP 711952) "pika/w/d/0"  0x000055555596d8d3 in std::vector<pika::concurrency::detail::cache_aligned_data<pika::threads::detail::thread_queue<std::mutex, pika::threads::detail::lockfree_fifo, pika::threads::detail::lockfree_fifo, pika::threads::detail::lockfree_fifo>*, std::integral_constant<bool, true> >, std::allocator<pika::concurrency::detail::cache_aligned_data<pika::threads::detail::thread_queue<std::mutex, pika::threads::detail::lockfree_fifo, pika::threads::detail::lockfree_fifo, pika::threads::detail::lockfree_fifo>*, std::integral_constant<bool, true> > > >::operator[] (this=0x51e000000b78, __n=3)
    at /nix/store/v7dbfh5n7az2lcap0z1cv4jq0bikya8p-gcc-13.3.0/include/c++/13.3.0/bits/stl_vector.h:1129
* 3    Thread 0x7ffff0cfe6c0 (LWP 711953) "pika/w/d/1"  pika_main () at /home/mjs/src/pika/examples/quickstart/hello_world.cpp:19
  4    Thread 0x7fffef9f46c0 (LWP 711954) "pika/w/d/2"  0x00005555558cb86e in std::atomic<pika::threads::scheduler_mode>::load (this=0x51e000000088, __m=std::memory_order::relaxed)
    at /nix/store/v7dbfh5n7az2lcap0z1cv4jq0bikya8p-gcc-13.3.0/include/c++/13.3.0/atomic:297
  5    Thread 0x7fffee6ea6c0 (LWP 711955) "pika/w/d/3"  0x00005555555f57ec in __asan_stack_malloc_3 ()

@msimberg msimberg added this to the 0.31.0 milestone Nov 14, 2024
@msimberg msimberg self-assigned this Nov 14, 2024
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.02% (target: -1.00%) 94.74% (target: 90.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (c8275ee) 18263 13784 75.48%
Head commit (73dfc2c) 18263 (+0) 13780 (-4) 75.45% (-0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1329) 19 18 94.74%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Copy link
Contributor

@biddisco biddisco left a comment

Choose a reason for hiding this comment

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

Seems reasonable

@msimberg msimberg added this pull request to the merge queue Nov 19, 2024
@msimberg msimberg removed this pull request from the merge queue due to a manual request Nov 19, 2024
@msimberg msimberg merged commit b207b3f into pika-org:main Nov 19, 2024
36 of 37 checks passed
@msimberg msimberg deleted the main-thread-no-name branch November 19, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants