Skip to content

Commit

Permalink
WIP: GAP.jl integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbehrends committed Feb 10, 2020
1 parent c511c8b commit e13cfb5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/hpc/threadapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@

#include <pthread.h>

#ifdef USE_JULIA_GC
#include "libgap-api.h"
#endif


#define RequireThread(funcname, op, argname) \
RequireArgumentConditionEx(funcname, op, "<" argname ">", \
Expand Down Expand Up @@ -431,6 +435,20 @@ void StopKeepAlive(Obj node)
static GVarDescriptor GVarTHREAD_INIT;
static GVarDescriptor GVarTHREAD_EXIT;

#ifdef USE_JULIA_GC
#define INTERPRETER_INIT 2
void InitInterpreterState()
{
if ((TLS(threadInit) & INTERPRETER_INIT) == 0) {
GAP_InitializeThread();
}
TLS(threadInit) |= INTERPRETER_INIT;
STATE(NrError) = 0;
STATE(ThrownObject) = 0;
SWITCH_TO_OLD_LVARS(STATE(BottomLVars));
}
#endif

static void ThreadedInterpreter(void * funcargs)
{
Obj tmp, func, oldLVars;
Expand Down

0 comments on commit e13cfb5

Please sign in to comment.