Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 0177dac

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Guard GC initialization
This way, OMEdit can use GC (does not require threadData) before Main.init (requires threadData).
1 parent 669113d commit 0177dac

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Compiler/runtime/systemimpl.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,12 +2757,16 @@ int SystemImpl__fileIsNewerThan(const char *file1, const char *file2)
27572757

27582758
void SystemImpl__initGarbageCollector(void)
27592759
{
2760-
GC_init();
2761-
GC_register_displacement(0);
2760+
static init=0;
2761+
if (!init) {
2762+
GC_init();
2763+
GC_register_displacement(0);
27622764
#ifdef RML_STYLE_TAGPTR
2763-
GC_register_displacement(3);
2765+
GC_register_displacement(3);
27642766
#endif
2765-
GC_set_force_unmap_on_gcollect(1);
2767+
GC_set_force_unmap_on_gcollect(1);
2768+
init=1;
2769+
}
27662770
}
27672771

27682772
int SystemImpl__fileContentsEqual(const char *file1, const char *file2)

0 commit comments

Comments
 (0)