File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. The format
7
7
### Changed
8
8
9
9
- Move to Hwloc 2+
10
+ - Initialize before main to avoid problems with setlocale
10
11
11
12
## [0.1]
12
13
Original file line number Diff line number Diff line change @@ -519,6 +519,7 @@ SCTK_INTERN struct sctk_alloc_chain * sctk_alloc_posix_create_new_tls_chain(void
519
519
* Setup the allocation chain for the current thread. It init an allocation chain and point it with
520
520
* the TLS sctk_current_alloc_chain.
521
521
**/
522
+
522
523
SCTK_INTERN struct sctk_alloc_chain * sctk_alloc_posix_setup_tls_chain (void )
523
524
{
524
525
//vars
@@ -544,6 +545,18 @@ SCTK_INTERN struct sctk_alloc_chain * sctk_alloc_posix_setup_tls_chain(void)
544
545
return chain ;
545
546
}
546
547
548
+ /* Ensure Main thread has an allocator before the main */
549
+ void __build_tls_chain (void ) __attribute__ ((constructor ));
550
+
551
+ void __build_tls_chain (void )
552
+ {
553
+ if (sctk_get_tls_chain () == NULL )
554
+ {
555
+ sctk_alloc_posix_setup_tls_chain ();
556
+ }
557
+ }
558
+
559
+
547
560
/************************* FUNCTION ************************/
548
561
SCTK_PUBLIC void * sctk_calloc (size_t nmemb , size_t size )
549
562
{
You can’t perform that action at this time.
0 commit comments