[gambit-list] Bug on OS X, due to linker's incomplete support of thread local storage class
thewhimer at gmail.com
thewhimer at gmail.com
Sun Mar 15 20:50:58 EDT 2015
After a second thought, that there were probably not many people using the ‘enable-multiple-vms’ option, so I decided to take some time to track it down.
The OS X linker does not support linking an "extern __thread var”, I can do nothing about that.
But the crash bug in pthread_get/setspecific fallback approach, turned out to be a minor issue: the pthread_key_t has to be created before used.
Patch follows, but i am not sure that is the right position to fix it.
diff --git a/lib/setup.c b/lib/setup.c
index 1dc009d..c81de87 100644
--- a/lib/setup.c
+++ b/lib/setup.c
@@ -16,6 +16,7 @@
#include "setup.h"
#include "mem.h"
#include "c_intf.h"
+#include "os_thread.h"
/*---------------------------------------------------------------------------*/
@@ -2430,6 +2431,9 @@ ___virtual_machine_state ___vms;)
* Setup virtual machine's memory management.
*/
+#ifndef ___THREAD_LOCAL_STORAGE_CLASS
+ ___setup_thread_module ();
+#endif
___setup_mem_vmstate (___vms);
/*
More information about the Gambit-list
mailing list