Thread overview
[Issue 18815] thread_attachThis crash
May 01, 2018
Manu
May 01, 2018
Manu
May 14, 2018
Manu
Dec 14, 2018
Walter Bright
Dec 14, 2018
Walter Bright
Mar 22, 2019
Tomáš Chaloupka
May 26, 2019
Nicholas Wilson
May 01, 2018
https://issues.dlang.org/show_bug.cgi?id=18815

--- Comment #1 from Manu <turkeyman@gmail.com> ---
I just confirmed, this is a regression from 2.78 to 2.79. It runs when building with 2.78, newer releases segfault.

main.cpp:
---------
#include <thread>

extern "C" void rt_init();
extern "C" void dfunc();

void thread_func()
{
    dfunc();
}

void main()
{
    rt_init();

    std::thread thread(thread_func);
    thread.join();
}

test.d:
-------
import std.stdio;

extern(C) void dfunc()
{
        import core.thread;
        thread_attachThis();

        writeln("Hello\n");
}

--
May 01, 2018
https://issues.dlang.org/show_bug.cgi?id=18815

Manu <turkeyman@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |C++, industry
           Severity|enhancement                 |regression

--
May 14, 2018
https://issues.dlang.org/show_bug.cgi?id=18815

--- Comment #2 from Manu <turkeyman@gmail.com> ---
This is kinda critical...

--
December 14, 2018
https://issues.dlang.org/show_bug.cgi?id=18815

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
It is likely crashing because your main() is on the C++ side, and so the D runtime library never gets initialized.

--
December 14, 2018
https://issues.dlang.org/show_bug.cgi?id=18815

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Walter Bright from comment #3)
> It is likely crashing because your main() is on the C++ side, and so the D runtime library never gets initialized.

Oh, I see you called rt_init().

--
March 22, 2019
https://issues.dlang.org/show_bug.cgi?id=18815

Tomáš Chaloupka <chalucha@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chalucha@gmail.com

--- Comment #5 from Tomáš Chaloupka <chalucha@gmail.com> ---
Isn't this solved in bug 19313?

--
May 26, 2019
https://issues.dlang.org/show_bug.cgi?id=18815

Nicholas Wilson <iamthewilsonator@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iamthewilsonator@hotmail.co
                   |                            |m

--- Comment #6 from Nicholas Wilson <iamthewilsonator@hotmail.com> ---
It would seem so.

--