more fixes for threads
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1000 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
0c1ed177f6
commit
d81bcb58e3
@ -6369,6 +6369,10 @@ Yap_absmi(int inp)
|
||||
UNLOCK(pe->PELock);
|
||||
JMPNext();
|
||||
}
|
||||
if (PP == NULL) {
|
||||
READ_LOCK(pe->PRWLock);
|
||||
PP = pe;
|
||||
}
|
||||
#endif
|
||||
saveregs();
|
||||
pt0 = Yap_ExpandIndex(pe);
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Last rev: *
|
||||
* mods: *
|
||||
* comments: allocating space *
|
||||
* version:$Id: alloc.c,v 1.46 2004-02-19 19:24:44 vsc Exp $ *
|
||||
* version:$Id: alloc.c,v 1.47 2004-02-20 18:56:06 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
#ifdef SCCS
|
||||
static char SccsId[] = "%W% %G%";
|
||||
@ -189,7 +189,7 @@ Yap_InitExStacks(int Trail, int Stack)
|
||||
void
|
||||
Yap_KillStacks(int wid)
|
||||
{
|
||||
ADDR gb = Yap_thread_gl[worker_id].global_base;
|
||||
ADDR gb = Yap_thread_gl[wid].global_base;
|
||||
if (gb) {
|
||||
free(gb);
|
||||
Yap_thread_gl[wid].global_base = NULL;
|
||||
|
@ -1130,6 +1130,9 @@ addclause(Term t, yamop *cp, int mode, int mod)
|
||||
/* we are redefining a prolog module predicate */
|
||||
if (p->ModuleOfPred == PROLOG_MODULE &&
|
||||
mod != TermProlog && mod) {
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
WPP = NULL;
|
||||
#endif
|
||||
WRITE_UNLOCK(p->PRWLock);
|
||||
addcl_permission_error(RepAtom(at), Arity, FALSE);
|
||||
return TermNil;
|
||||
@ -1236,6 +1239,9 @@ Yap_EraseStaticClause(StaticClause *cl, Term mod) {
|
||||
}
|
||||
}
|
||||
WRITE_LOCK(ap->PRWLock);
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
WPP = NULL;
|
||||
#endif
|
||||
if (ap->PredFlags & IndexedPredFlag)
|
||||
RemoveIndexation(ap);
|
||||
ap->cs.p_code.NOfClauses--;
|
||||
@ -1277,6 +1283,9 @@ Yap_EraseStaticClause(StaticClause *cl, Term mod) {
|
||||
ap->OpcodeOfPred =
|
||||
ap->cs.p_code.TrueCodeOfPred->opc;
|
||||
}
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
WPP = NULL;
|
||||
#endif
|
||||
WRITE_UNLOCK(ap->PRWLock);
|
||||
if (cl->ClFlags & HasBlobsMask || static_in_use(ap,TRUE)) {
|
||||
DeadClause *dcl = (DeadClause *)cl;
|
||||
|
15
C/dbase.c
15
C/dbase.c
@ -3850,8 +3850,13 @@ static void
|
||||
EraseLogUpdCl(LogUpdClause *clau)
|
||||
{
|
||||
PredEntry *ap;
|
||||
LOCK(clau->ClLock);
|
||||
ap = clau->ClPred;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
if (WPP != ap) {
|
||||
WRITE_LOCK(ap->PRWLock);
|
||||
}
|
||||
#endif
|
||||
LOCK(clau->ClLock);
|
||||
/* no need to erase what has been erased */
|
||||
if (!(clau->ClFlags & ErasedMask)) {
|
||||
/* get ourselves out of the list */
|
||||
@ -3865,7 +3870,7 @@ EraseLogUpdCl(LogUpdClause *clau)
|
||||
clau->ClPrev->ClNext = clau->ClNext;
|
||||
UNLOCK(clau->ClPrev->ClLock);
|
||||
}
|
||||
WRITE_LOCK(ap->PRWLock);
|
||||
UNLOCK(clau->ClLock);
|
||||
if (clau->ClCode == ap->cs.p_code.FirstClause) {
|
||||
if (clau->ClNext == NULL) {
|
||||
ap->cs.p_code.FirstClause = NULL;
|
||||
@ -3881,7 +3886,6 @@ EraseLogUpdCl(LogUpdClause *clau)
|
||||
}
|
||||
}
|
||||
ap->cs.p_code.NOfClauses--;
|
||||
WRITE_UNLOCK(ap->PRWLock);
|
||||
clau->ClFlags |= ErasedMask;
|
||||
#ifdef DEBUG
|
||||
{
|
||||
@ -3906,6 +3910,11 @@ EraseLogUpdCl(LogUpdClause *clau)
|
||||
}
|
||||
UNLOCK(clau->ClLock);
|
||||
complete_lu_erase(clau);
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
if (WPP != ap) {
|
||||
WRITE_UNLOCK(ap->PRWLock);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
3
C/exec.c
3
C/exec.c
@ -1162,6 +1162,9 @@ do_goal(yamop *CodeAdr, int arity, CELL *pt, int top)
|
||||
#endif /* DEPTH_LIMIT */
|
||||
YENV = ASP = (CELL *)B;
|
||||
HB = H;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
WPP = NULL;
|
||||
#endif
|
||||
YENV[E_CB] = Unsigned (B);
|
||||
P = (yamop *) CodeAdr;
|
||||
CP = YESCODE;
|
||||
|
@ -1326,7 +1326,7 @@ InitSignals (void)
|
||||
#ifndef MPW
|
||||
my_signal (SIGFPE, HandleMatherr);
|
||||
#endif
|
||||
#if HAVE_SIGSEGV
|
||||
#if HAVE_SIGSEGV && !defined(THREADS)
|
||||
my_signal_info (SIGSEGV, HandleSIGSEGV);
|
||||
#endif
|
||||
#ifdef ACOW
|
||||
|
@ -116,9 +116,6 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
||||
|
||||
LOCK(heap_regs->low_level_trace_lock);
|
||||
vsc_count++;
|
||||
if (vsc_count == 52404) vsc_xstop = 1;
|
||||
UNLOCK(heap_regs->low_level_trace_lock);
|
||||
return;
|
||||
#ifdef COMMENTED
|
||||
// if (vsc_count == 218280)
|
||||
// vsc_xstop = 1;
|
||||
|
12
m4/Yap.h.m4
12
m4/Yap.h.m4
@ -10,7 +10,7 @@
|
||||
* File: Yap.h.m4 *
|
||||
* mods: *
|
||||
* comments: main header file for YAP *
|
||||
* version: $Id: Yap.h.m4,v 1.53 2004-02-13 18:39:29 vsc Exp $ *
|
||||
* version: $Id: Yap.h.m4,v 1.54 2004-02-20 18:56:07 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
@ -333,6 +333,11 @@ typedef CELL Term;
|
||||
#if !defined(YAPOR) && !defined(THREADS)
|
||||
#include <nolocks.h>
|
||||
#elif USE_PTHREAD_LOCKING
|
||||
|
||||
#ifndef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
|
||||
typedef pthread_mutex_t lockvar;
|
||||
typedef pthread_rwlock_t rwlock_t;
|
||||
#include <pthread_locks.h>
|
||||
@ -349,6 +354,11 @@ typedef volatile int lockvar;
|
||||
typedef volatile int lockvar;
|
||||
#include <alpha_locks.h>
|
||||
#else
|
||||
|
||||
#ifndef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
|
||||
typedef pthread_mutex_t lockvar;
|
||||
typedef pthread_rwlock_t rwlock_t;
|
||||
#include <pthread_locks.h>
|
||||
|
Reference in New Issue
Block a user