File tree 3 files changed +25
-7
lines changed
3 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -1393,13 +1393,12 @@ private:
1393
1393
lock[] = Mutex .classinfo.init[];
1394
1394
(cast (Mutex )lock.ptr).__ctor();
1395
1395
}
1396
+ }
1396
1397
1397
- extern (C ) void destroy ()
1398
- {
1399
- foreach (ref lock; _locks)
1400
- (cast (Mutex )lock.ptr).__dtor();
1401
- }
1402
- atexit(&destroy );
1398
+ static void termLocks ()
1399
+ {
1400
+ foreach (ref lock; _locks)
1401
+ (cast (Mutex )lock.ptr).__dtor();
1403
1402
}
1404
1403
1405
1404
__gshared Context* sm_cbeg;
@@ -1726,6 +1725,16 @@ extern (C) void thread_init()
1726
1725
}
1727
1726
1728
1727
1728
+ /**
1729
+ * Terminates the thread module. No other thread routine may be called
1730
+ * afterwards.
1731
+ */
1732
+ extern (C ) void thread_term()
1733
+ {
1734
+ Thread .termLocks();
1735
+ }
1736
+
1737
+
1729
1738
/**
1730
1739
*
1731
1740
*/
Original file line number Diff line number Diff line change @@ -436,6 +436,13 @@ private:
436
436
extern (C ) void thread_init();
437
437
438
438
439
+ /**
440
+ * Terminates the thread module. No other thread routine may be called
441
+ * afterwards.
442
+ */
443
+ extern (C ) void thread_term();
444
+
445
+
439
446
/**
440
447
*
441
448
*/
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ private
29
29
__gshared gc_t _gc;
30
30
31
31
extern (C ) void thread_init();
32
+ extern (C ) void thread_term();
32
33
33
34
struct Proxy
34
35
{
@@ -136,8 +137,9 @@ extern (C)
136
137
// the problems mentioned above though, so I guess we'll see.
137
138
_gc.fullCollectNoStack(); // not really a 'collect all' -- still scans
138
139
// static data area, roots, and ranges.
139
- _gc.Dtor ();
140
+ thread_term ();
140
141
142
+ _gc.Dtor();
141
143
free(cast (void * )_gc);
142
144
_gc = null ;
143
145
}
You can’t perform that action at this time.
0 commit comments