improve multi-threading support from C-interface. Still not quite there.

This commit is contained in:
Vitor Santos Costa
2012-12-11 22:07:10 +00:00
parent ac74c9e3de
commit e41f821d67
11 changed files with 126 additions and 79 deletions

View File

@@ -3071,7 +3071,7 @@ YAP_Init(YAP_init_args *yap_init)
}
{ BACKUP_MACHINE_REGS();
Yap_InitYaamRegs();
Yap_InitYaamRegs( 0);
#if HAVE_MPE
Yap_InitMPE ();
@@ -3111,7 +3111,7 @@ YAP_Init(YAP_init_args *yap_init)
In the SBA we cannot just happily inherit registers
from the other workers
*/
Yap_InitYaamRegs();
Yap_InitYaamRegs( 0);
#endif /* YAPOR_COPY || YAPOR_SBA */
#ifndef YAPOR_THREADS
Yap_InitPreAllocCodeSpace();
@@ -3190,7 +3190,7 @@ YAP_Init(YAP_init_args *yap_init)
/* first, initialise the saved state */
Term t_goal = MkAtomTerm(AtomInitProlog);
YAP_RunGoalOnce(t_goal);
Yap_InitYaamRegs();
Yap_InitYaamRegs( 0 );
/* reset stacks */
return YAP_BOOT_FROM_SAVED_CODE;
} else {
@@ -3224,7 +3224,7 @@ YAP_Init(YAP_init_args *yap_init)
goal = Yap_MkApplTerm(fgoal, 1, as);
YAP_RunGoalOnce(goal);
/* reset stacks */
Yap_InitYaamRegs();
Yap_InitYaamRegs( 0 );
}
Yap_PutValue(Yap_FullLookupAtom("$live"), MkAtomTerm (Yap_FullLookupAtom("$true")));
}
@@ -3305,13 +3305,13 @@ YAP_Reset(void)
if (Yap_exec_absmi(0) != 0) {
GLOBAL_Initialised = TRUE;
Yap_InitYaamRegs();
Yap_InitYaamRegs( worker_id );
RECOVER_MACHINE_REGS();
return FALSE;
}
}
/* reinitialise the engine */
Yap_InitYaamRegs();
Yap_InitYaamRegs( worker_id );
GLOBAL_Initialised = TRUE;
RECOVER_MACHINE_REGS();
@@ -3531,7 +3531,7 @@ YAP_ThreadAttachEngine( int wid)
#else
return FALSE;
#endif
}
}
X_API int
YAP_ThreadDetachEngine(int wid)