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

NTJ thewhimer at gmail.com
Sun Mar 15 21:07:45 EDT 2015


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);
>
>    /*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150316/47aea6f9/attachment.htm>


More information about the Gambit-list mailing list