https://github.com/JuliaLang/julia
Revision 3d88550124d30ac88fd68a851df2a67216a5854b authored by Gabriel Baraldi on 06 September 2023, 10:35:01 UTC, committed by GitHub on 06 September 2023, 10:35:01 UTC
This avoids a crashes where we run the destructors because C++ is fun
and runs destructors before thread exit.
1 parent f9d1767
Raw File
Tip revision: 3d88550124d30ac88fd68a851df2a67216a5854b authored by Gabriel Baraldi on 06 September 2023, 10:35:01 UTC
Wait for other threads to finish compiling before exiting (#51213)
Tip revision: 3d88550
threading.h
// This file is a part of Julia. License is MIT: https://julialang.org/license

#ifndef THREADING_H
#define THREADING_H

#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif

#include "julia.h"

#define PROFILE_JL_THREADING            0

extern _Atomic(jl_ptls_t*) jl_all_tls_states JL_GLOBALLY_ROOTED; /* thread local storage */

typedef struct _jl_threadarg_t {
    int16_t tid;
    uv_barrier_t *barrier;
    void *arg;
} jl_threadarg_t;

// each thread must initialize its TLS
jl_ptls_t jl_init_threadtls(int16_t tid) JL_NOTSAFEPOINT;

// provided by a threading infrastructure
void jl_init_threadinginfra(void);
void jl_gc_mark_threadfun(void *arg);
void jl_gc_sweep_threadfun(void *arg);
void jl_threadfun(void *arg);

#ifdef __cplusplus
}
#endif

#endif  /* THREADING_H */
back to top