Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/core/thread/osthread.d
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class Thread : ThreadBase
* In:
* fn must not be null.
*/
this( void function() fn, size_t sz = 0 ) @safe pure nothrow @nogc
this(return scope void function() fn, size_t sz = 0) @safe pure nothrow @nogc
{
super(fn, sz);
}
Expand All @@ -273,7 +273,7 @@ class Thread : ThreadBase
* In:
* dg must not be null.
*/
this( void delegate() dg, size_t sz = 0 ) @safe pure nothrow @nogc
this(return scope void delegate() dg, size_t sz = 0) @safe pure nothrow @nogc
{
super(dg, sz);
}
Expand Down Expand Up @@ -1143,6 +1143,18 @@ unittest
thr.join();
}

// https://issues.dlang.org/show_bug.cgi?id=22124
unittest
{
Thread thread = new Thread({});
auto fun(Thread t, int x)
{
t.__ctor({x = 3;});
return t;
}
assert(!__traits(compiles, () @nogc => fun(thread, 3) ));
}

unittest
{
import core.sync.semaphore;
Expand Down
4 changes: 2 additions & 2 deletions src/core/thread/threadbase.d
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ class ThreadBase
// Initialization
///////////////////////////////////////////////////////////////////////////

this(void function() fn, size_t sz = 0) @safe pure nothrow @nogc
this(return scope void function() fn, size_t sz = 0) @safe pure nothrow @nogc
in(fn)
{
this(sz);
m_call = fn;
}

this(void delegate() dg, size_t sz = 0) @safe pure nothrow @nogc
this(return scope void delegate() dg, size_t sz = 0) @safe pure nothrow @nogc
in(dg)
{
this(sz);
Expand Down