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

View File

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

View File

@ -175,7 +175,7 @@ extern struct worker_shared Yap_Global;
#define Yap_global (&Yap_Global) #define Yap_global (&Yap_Global)
#if defined(YAPOR) || defined(THREADS) #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 WL (Yap_WLocal+worker_id)
#define FOREIGN_WL(wid) (Yap_WLocal+(wid)) #define FOREIGN_WL(wid) (Yap_WLocal+(wid))
#else #else