Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 1e75c50

Browse files
committed
Make thread_attachThis nothrow
In case any of the GC operations in the thread_attachThis fail with the Error, it's likely that GC.enable will also throw an error. This is not allowed for the statically allocated errors (such as InvalidMemoryOperationError, commonly thrown by GC), and it will cause deadlock where the t->next will be same as t. In order to prevent this, we need to make scope(exit) GC.enable() scope(success) GC.enable(), but then to make sure there will be no exception which will cause GC.enable to be skiped, we will make entire thread_attachThis nothrow.
1 parent f9276a7 commit 1e75c50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/thread.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ extern (C) bool thread_isMainThread() nothrow @nogc
20732073
*
20742074
* extern (C) void rt_moduleTlsCtor();
20752075
*/
2076-
extern (C) Thread thread_attachThis()
2076+
extern (C) Thread thread_attachThis() nothrow
20772077
{
20782078
GC.disable(); scope(exit) GC.enable();
20792079

0 commit comments

Comments
 (0)