separate MAX_WORKERS and MAX_THREADS (obs from Paulo Moura)

MAX_AGENTS can be used in all cases


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2189 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2008-04-02 15:41:50 +00:00
parent 7aab33a153
commit 70b3438293
8 changed files with 3310 additions and 1037 deletions

View File

@@ -83,9 +83,9 @@ ADDR Yap_HeapBase;
#if defined(THREADS)
struct restore_info rinfo[MAX_WORKERS];
struct restore_info rinfo[MAX_THREADS];
struct thread_globs Yap_thread_gl[MAX_WORKERS];
struct thread_globs Yap_thread_gl[MAX_THREADS];
#else
@@ -968,7 +968,7 @@ InitCodes(void)
INIT_LOCK(Yap_heap_regs->thread_handles_lock);
{
int i;
for (i=0; i < MAX_WORKERS; i++) {
for (i=0; i < MAX_THREADS; i++) {
Yap_heap_regs->thread_handle[i].in_use = FALSE;
Yap_heap_regs->thread_handle[i].zombie = FALSE;
Yap_heap_regs->thread_handle[i].local_preds = NULL;
@@ -1001,7 +1001,7 @@ InitCodes(void)
Yap_heap_regs->heap_top_owner = -1;
{
int i;
for (i=0; i < MAX_WORKERS; i++) {
for (i=0; i < MAX_AGENTS; i++) {
INIT_LOCK(Yap_heap_regs->wl[i].signal_lock);
Yap_heap_regs->wl[i].active_signals = 0;
Yap_heap_regs->wl[i].scratchpad.ptr = NULL;

View File

@@ -43,11 +43,11 @@ allocate_new_tid(void)
{
int new_worker_id = 0;
LOCK(ThreadHandlesLock);
while(new_worker_id < MAX_WORKERS &&
while(new_worker_id < MAX_THREADS &&
(ThreadHandle[new_worker_id].in_use == TRUE ||
ThreadHandle[new_worker_id].zombie == TRUE) )
new_worker_id++;
if (new_worker_id < MAX_WORKERS) {
if (new_worker_id < MAX_THREADS) {
pthread_mutex_lock(&(ThreadHandle[new_worker_id].tlock));
ThreadHandle[new_worker_id].in_use = TRUE;
} else {
@@ -184,7 +184,7 @@ p_thread_new_tid(void)
{
int new_worker = allocate_new_tid();
if (new_worker == -1) {
Yap_Error(RESOURCE_ERROR_MAX_THREADS, MkIntegerTerm(MAX_WORKERS), "");
Yap_Error(RESOURCE_ERROR_MAX_THREADS, MkIntegerTerm(MAX_THREADS), "");
return FALSE;
}
return Yap_unify(MkIntegerTerm(new_worker), ARG1);
@@ -617,7 +617,7 @@ p_nof_threads(void)
{ /* '$nof_threads'(+P) */
int i = 0, wid;
LOCK(ThreadHandlesLock);
for (wid = 0; wid < MAX_WORKERS; wid++) {
for (wid = 0; wid < MAX_THREADS; wid++) {
if (ThreadHandle[wid].in_use)
i++;
}
@@ -628,7 +628,7 @@ p_nof_threads(void)
static Int
p_max_threads(void)
{ /* '$max_threads'(+P) */
return Yap_unify(ARG1,MkIntegerTerm(MAX_WORKERS));
return Yap_unify(ARG1,MkIntegerTerm(MAX_THREADS));
}
static Int