more locking fixes
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2306 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
8350d52c78
commit
7db64c5e1c
18
C/absmi.c
18
C/absmi.c
@ -10,8 +10,14 @@
|
||||
* *
|
||||
* File: absmi.c *
|
||||
* comments: Portable abstract machine interpreter *
|
||||
* Last rev: $Date: 2008-08-12 01:27:22 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2008-08-13 01:16:26 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.246 2008/08/12 01:27:22 vsc
|
||||
* MaxOS fixes
|
||||
* Avoid a thread deadlock
|
||||
* improvements to SWI predicates.
|
||||
* make variables_in_term system builtin.
|
||||
*
|
||||
* Revision 1.245 2008/08/07 20:51:15 vsc
|
||||
* more threadin fixes
|
||||
*
|
||||
@ -13806,8 +13812,8 @@ Yap_absmi(int inp)
|
||||
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
||||
LOCK(SignalLock);
|
||||
UNLOCK(SignalLock);
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
UNLOCK(SignalLock);
|
||||
saveregs_and_ycache();
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
|
||||
@ -13818,12 +13824,13 @@ Yap_absmi(int inp)
|
||||
LOCK(SignalLock);
|
||||
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
if (!ActiveSignals) {
|
||||
UNLOCK(SignalLock);
|
||||
goto execute_after_comma;
|
||||
}
|
||||
}
|
||||
if (ActiveSignals & YAP_TROVF_SIGNAL) {
|
||||
UNLOCK(SignalLock);
|
||||
#ifdef SHADOW_S
|
||||
S = SREG;
|
||||
#endif
|
||||
@ -13837,17 +13844,20 @@ Yap_absmi(int inp)
|
||||
LOCK(SignalLock);
|
||||
ActiveSignals &= ~YAP_TROVF_SIGNAL;
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
if (!ActiveSignals) {
|
||||
UNLOCK(SignalLock);
|
||||
goto execute_after_comma;
|
||||
}
|
||||
}
|
||||
if (ActiveSignals) {
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
UNLOCK(SignalLock);
|
||||
goto noheapleft;
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
goto creep;
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
saveregs();
|
||||
if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, ENV, NEXTOP(PREG, sla))) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage);
|
||||
|
50
C/sysbits.c
50
C/sysbits.c
@ -2529,36 +2529,57 @@ p_first_signal(void)
|
||||
non-backtrackable variable bad */
|
||||
if (ActiveSignals & YAP_WAKEUP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_WAKEUP_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_wake_up")));
|
||||
}
|
||||
if (ActiveSignals & YAP_ITI_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_ITI_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_iti")));
|
||||
}
|
||||
if (ActiveSignals & YAP_INT_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_INT_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_int")));
|
||||
}
|
||||
if (ActiveSignals & YAP_USR2_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_USR2_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_usr2")));
|
||||
}
|
||||
if (ActiveSignals & YAP_USR1_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_USR1_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_usr1")));
|
||||
}
|
||||
if (ActiveSignals & YAP_PIPE_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_PIPE_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_pipe")));
|
||||
}
|
||||
if (ActiveSignals & YAP_HUP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_HUP_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_hup")));
|
||||
}
|
||||
@ -2569,43 +2590,64 @@ p_first_signal(void)
|
||||
}
|
||||
if (ActiveSignals & YAP_DELAY_CREEP_SIGNAL) {
|
||||
ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_delay_creep")));
|
||||
}
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_creep")));
|
||||
}
|
||||
if (ActiveSignals & YAP_TRACE_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_TRACE_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_trace")));
|
||||
}
|
||||
if (ActiveSignals & YAP_DEBUG_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_DEBUG_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_debug")));
|
||||
}
|
||||
if (ActiveSignals & YAP_BREAK_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_BREAK_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_break")));
|
||||
}
|
||||
if (ActiveSignals & YAP_STACK_DUMP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_STACK_DUMP_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_stack_dump")));
|
||||
}
|
||||
if (ActiveSignals & YAP_STATISTICS_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_STATISTICS_SIGNAL;
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_statistics")));
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(Yap_LookupAtom("sig_statistics")));
|
||||
}
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(ThreadHandle[worker_id].tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,8 @@
|
||||
<h2>Yap-5.1.4:</h2>
|
||||
<ul>
|
||||
<li> .</li>
|
||||
<li> FIXED: DESTIR and chr.</li>
|
||||
<li> FIXED: bad locking in p_signal (obs from Paulo Moura).</li>
|
||||
<li> FIXED: DESTDIR and chr.</li>
|
||||
<li> FIXED: make term_variables a builtin. (SWI compatibility).</li>
|
||||
<li> NEW: X is random(Int) (SWI compatibility).</li>
|
||||
<li> NEW: seletchk/3.</li>
|
||||
|
Reference in New Issue
Block a user