diff --git a/C/init.c b/C/init.c index 657807f4b..9fffbb4b7 100755 --- a/C/init.c +++ b/C/init.c @@ -1244,9 +1244,6 @@ InitCodes(void) int wid; #include "ihstruct.h" InitGlobal(); - for (wid = 0; wid < MAX_INITS; wid++) { - InitWorker(wid); - } InitFirstWorkerThreadHandle(); /* make sure no one else can use these two atoms */ CurrentModule = 0; diff --git a/C/threads.c b/C/threads.c index c90f7ee44..581228cf4 100755 --- a/C/threads.c +++ b/C/threads.c @@ -165,6 +165,7 @@ setup_engine(int myworker_id, int init_thread) REGSTORE *standard_regs; standard_regs = (REGSTORE *)calloc(1,sizeof(REGSTORE)); + regcache = standard_regs; /* create the YAAM descriptor */ FOREIGN_ThreadHandle(myworker_id).default_yaam_regs = standard_regs; if (init_thread) { @@ -200,6 +201,7 @@ thread_run(void *widp) int myworker_id = *((int *)widp); start_thread(myworker_id); + regcache = ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key)); do { t = tgs[0] = Yap_PopTermFromDB(MY_ThreadHandle.tgoal); if (t == 0) {