[gambit-list] Bug on OS X, due to linker's incomplete support of thread local storage class

Marc Feeley feeley at iro.umontreal.ca
Mon Mar 16 14:11:41 EDT 2015


Thanks for reporting the problem.  Indeed the os_thread module was not initialized (this only mattered when the C compiler did not support a thread local storage qualifier, which I guess is unusual).

Marc


> On Mar 15, 2015, at 9:07 PM, NTJ <thewhimer at gmail.com> wrote:
> 
> Strangely, a bounce-back email complained me being not a subscriber, but i subscribed and comfirmed already. If my message is malformed or something else, please let me know. :-)
> 
> 
> On Mon, Mar 16, 2015 at 12:11 AM, <thewhimer at gmail.com> wrote:
> 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);
> 
>    /*
> 
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4839 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150316/9b7d7ae0/attachment.bin>


More information about the Gambit-list mailing list