diff --git a/C/threads.c b/C/threads.c index 553ae7611..6a0b33da6 100644 --- a/C/threads.c +++ b/C/threads.c @@ -338,6 +338,15 @@ p_thread_set_concurrency(void) return Yap_unify(ARG1, MkIntegerTerm(cur)); } +static Int +p_thread_yield(void) +{ + if (sched_yield() != 0) { + return FALSE; + } + return TRUE; +} + static Int p_valid_thread(void) { @@ -545,6 +554,7 @@ void Yap_InitThreadPreds(void) Yap_InitCPred("$thread_self", 1, p_thread_self, SafePredFlag|HiddenPredFlag); Yap_InitCPred("$thread_join", 1, p_thread_join, HiddenPredFlag); Yap_InitCPred("$thread_destroy", 1, p_thread_destroy, HiddenPredFlag); + Yap_InitCPred("thread_yield", 0, p_thread_yield, 0); Yap_InitCPred("$detach_thread", 1, p_thread_detach, HiddenPredFlag); Yap_InitCPred("$thread_exit", 0, p_thread_exit, HiddenPredFlag); Yap_InitCPred("thread_setconcurrency", 2, p_thread_set_concurrency, 0); diff --git a/C/tracer.c b/C/tracer.c index acd131f7d..319b8093e 100644 --- a/C/tracer.c +++ b/C/tracer.c @@ -161,6 +161,8 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) LOCK(Yap_heap_regs->low_level_trace_lock); sc = Yap_heap_regs; vsc_count++; + if (vsc_count < 81000) + return; #ifdef COMMENTED if (worker_id != 04 || worker_id != 03) return; // if (vsc_count == 218280) diff --git a/changes-5.1.html b/changes-5.1.html index d908d2c6d..56c804c6a 100644 --- a/changes-5.1.html +++ b/changes-5.1.html @@ -16,6 +16,8 @@

Yap-5.1.2: