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

Commit 00e1945

Browse files
committed
separate thread_init/term from gc_init/term
1 parent e79a687 commit 00e1945

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/gc/proxy.d

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ private
2525
static import core.memory;
2626
alias BlkInfo = core.memory.GC.BlkInfo;
2727

28-
extern (C) void thread_init();
29-
extern (C) void thread_term();
30-
3128
__gshared GC instance;
3229
__gshared GC proxiedGC; // used to iterate roots of Windows DLLs
3330

@@ -50,10 +47,6 @@ extern (C)
5047
fprintf(stderr, "No GC was initialized, please recheck the name of the selected GC ('%.*s').\n", cast(int)config.gc.length, config.gc.ptr);
5148
exit(1);
5249
}
53-
54-
// NOTE: The GC must initialize the thread library
55-
// before its first collection.
56-
thread_init();
5750
}
5851

5952
void gc_term()
@@ -71,8 +64,6 @@ extern (C)
7164
instance.collectNoStack(); // not really a 'collect all' -- still scans
7265
// static data area, roots, and ranges.
7366

74-
thread_term();
75-
7667
ManualGC.finalize(instance);
7768
ConservativeGC.finalize(instance);
7869
}

src/rt/dmain2.d

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ extern (C) void _d_critical_init();
5656
extern (C) void _d_critical_term();
5757
extern (C) void gc_init();
5858
extern (C) void gc_term();
59+
extern (C) void thread_init() @nogc;
60+
extern (C) void thread_term() @nogc;
5961
extern (C) void lifetime_init();
6062
extern (C) void rt_moduleCtor();
6163
extern (C) void rt_moduleTlsCtor();
@@ -190,6 +192,7 @@ extern (C) int rt_init()
190192
// this initializes mono time before anything else to allow usage
191193
// in other druntime systems.
192194
_d_initMonoTime();
195+
thread_init();
193196
gc_init();
194197
initStaticDataGC();
195198
lifetime_init();
@@ -221,6 +224,7 @@ extern (C) int rt_term()
221224
thread_joinAll();
222225
rt_moduleDtor();
223226
gc_term();
227+
thread_term();
224228
return 1;
225229
}
226230
catch (Throwable t)

0 commit comments

Comments
 (0)