initialise for 1024 threads (report from Jiefie Ma).

This commit is contained in:
Vitor Santos Costa 2010-10-12 23:16:51 +01:00
parent 80c38081da
commit b27a9869bf
3 changed files with 11 additions and 7 deletions

View File

@ -1146,6 +1146,9 @@ InitThreadHandle(int wid)
FOREIGN_ThreadHandle(wid).thread_inst_count = 0LL;
#endif
pthread_mutex_init(&(FOREIGN_ThreadHandle(wid).tlock), NULL);
pthread_mutex_init(&(FOREIGN_ThreadHandle(wid).tlock_status), NULL);
FOREIGN_ThreadHandle(wid).tdetach = (CELL)0;
FOREIGN_ThreadHandle(wid).cmod = (CELL)0;
}
#endif
@ -1197,7 +1200,7 @@ Yap_CloseScratchPad(void)
#include "iglobals.h"
#if defined(YAPOR) || defined(THREADS)
#define MAX_INITS MAX_WORKERS
#define MAX_INITS MAX_AGENTS
#else
#define MAX_INITS 1
#endif
@ -1205,7 +1208,7 @@ Yap_CloseScratchPad(void)
struct worker_shared Yap_Global;
#if defined(YAPOR) || defined(THREADS)
struct worker_local Yap_WLocal[MAX_WORKERS];
struct worker_local Yap_WLocal[MAX_AGENTS];
#else
struct worker_local Yap_WLocal;
#endif
@ -1216,8 +1219,9 @@ InitCodes(void)
int wid;
#include "ihstruct.h"
InitGlobal();
for (wid = 0; wid < MAX_INITS; wid++)
for (wid = 0; wid < MAX_INITS; wid++) {
InitWorker(wid);
}
InitFirstWorkerThreadHandle();
/* make sure no one else can use these two atoms */
CurrentModule = 0;

View File

@ -423,10 +423,10 @@ typedef pthread_rwlock_t rwlock_t;
#ifdef __alpha
#include <locks_alpha_funcs.h>
#endif
#ifdef YAPOR
#define MAX_AGENTS MAX_WORKERS
#elif defined(THREADS)
#if defined(THREADS)
#define MAX_AGENTS MAX_THREADS
#elif defined(YAPOR)
#define MAX_AGENTS MAX_WORKERS
#endif
#endif

View File

@ -175,7 +175,7 @@ extern struct worker_shared Yap_Global;
#define Yap_global (&Yap_Global)
#if defined(YAPOR) || defined(THREADS)
extern struct worker_local Yap_WLocal[MAX_WORKERS];
extern struct worker_local Yap_WLocal[MAX_AGENTS];
#define WL (Yap_WLocal+worker_id)
#define FOREIGN_WL(wid) (Yap_WLocal+(wid))
#else