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 @@ -1397,13 +1397,12 @@ private:
1397
1397
lock[] = Mutex .classinfo.init[];
1398
1398
(cast (Mutex )lock.ptr).__ctor();
1399
1399
}
1400
+ }
1400
1401
1401
- extern (C ) void destroy ()
1402
- {
1403
- foreach (ref lock; _locks)
1404
- (cast (Mutex )lock.ptr).__dtor();
1405
- }
1406
- atexit(&destroy );
1402
+ static void termLocks ()
1403
+ {
1404
+ foreach (ref lock; _locks)
1405
+ (cast (Mutex )lock.ptr).__dtor();
1407
1406
}
1408
1407
1409
1408
__gshared Context* sm_cbeg;
@@ -1730,6 +1729,16 @@ extern (C) void thread_init()
1730
1729
}
1731
1730
1732
1731
1732
+ /**
1733
+ * Terminates the thread module. No other thread routine may be called
1734
+ * afterwards.
1735
+ */
1736
+ extern (C ) void thread_term()
1737
+ {
1738
+ Thread .termLocks();
1739
+ }
1740
+
1741
+
1733
1742
/**
1734
1743
*
1735
1744
*/
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