We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dbd5280 commit 79e98e3Copy full SHA for 79e98e3
src/threading.c
@@ -336,7 +336,17 @@ jl_ptls_t jl_init_threadtls(int16_t tid)
336
#endif
337
if (jl_get_pgcstack() != NULL)
338
abort();
339
- jl_ptls_t ptls = (jl_ptls_t)calloc(1, sizeof(jl_tls_states_t));
+ jl_ptls_t ptls;
340
+#if defined(_OS_WINDOWS_)
341
+ ptls = _aligned_malloc(sizeof(jl_tls_states_t), alignof(jl_tls_states_t));
342
+ if (ptls == NULL)
343
+ abort();
344
+#else
345
+ if (posix_memalign((void**)&ptls, alignof(jl_tls_states_t), sizeof(jl_tls_states_t)))
346
347
+#endif
348
+ memset(ptls, 0, sizeof(jl_tls_states_t));
349
+
350
#ifndef _OS_WINDOWS_
351
pthread_setspecific(jl_task_exit_key, (void*)ptls);
352
0 commit comments