From 92af2e87402962177ee47a2290d0c877f98d9b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 23 Mar 2011 15:15:09 +0000 Subject: [PATCH] ipatch case no more threads are available and alloc top_frame --- C/threads.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/C/threads.c b/C/threads.c index 0994d813c..5dbb4db37 100755 --- a/C/threads.c +++ b/C/threads.c @@ -57,7 +57,9 @@ allocate_new_tid(void) (FOREIGN_ThreadHandle(new_worker_id).in_use == TRUE || FOREIGN_ThreadHandle(new_worker_id).zombie == TRUE) ) new_worker_id++; - if (!Yap_WLocal[new_worker_id]) { + if (new_worker_id >= MAX_THREADS) { + new_worker_id = -1; + } else if (!Yap_WLocal[new_worker_id]) { DEBUG_TLOCK_ACCESS(new_worker_id, 0); if (!Yap_InitThread(new_worker_id)) { return -1; @@ -186,6 +188,9 @@ setup_engine(int myworker_id, int init_thread) Yap_InitYaamRegs(); #ifdef YAPOR Yap_init_local(); +#endif +#ifdef TABLING + new_dependency_frame(REMOTE_top_dep_fr(myworker_id)), FALSE, NULL, NULL, NULL, NULL, NULL); #endif Yap_ReleasePreAllocCodeSpace(Yap_PreAllocCodeSpace()); /* I exist */