make frame structure thread local.

This commit is contained in:
Vítor Santos Costa 2010-06-14 09:26:32 +01:00
parent a05bf5cfb0
commit bf26536626
7 changed files with 13 additions and 7 deletions

View File

@ -145,6 +145,7 @@
#define putc_cur_buf WL->putc_cur_buf_
#define putc_cur_lim WL->putc_cur_lim_
#define putc_cur_flags WL->putc_cur_flags_
#define execution WL->_execution
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
#define WORKER WL->worker

View File

@ -147,6 +147,7 @@ typedef struct worker_local {
char* putc_cur_buf_;
char* putc_cur_lim_;
UInt putc_cur_flags_;
struct open_query_struct* _execution;
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
struct worker worker;

View File

@ -145,6 +145,7 @@ static void InitWorker(int wid) {
FOREIGN_WL(wid)->putc_cur_buf_ = NULL;
FOREIGN_WL(wid)->putc_cur_lim_ = NULL;
FOREIGN_WL(wid)->putc_cur_flags_ = 0L;
FOREIGN_WL(wid)->_execution = NULL;
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)

View File

@ -146,6 +146,7 @@ static void RestoreWorker(int wid) {
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
#endif

View File

@ -35,7 +35,7 @@ CWD=$(PWD)
#
OBJS=yap2swi.o
SOBJS=yap2swi@SHLIB_SUFFIX@
SOBJS=yap2swi.@SHLIB_SUFFIX@
#in some systems we just create a single object, in others we need to
# create a libray
@ -47,11 +47,11 @@ all:
yap2swi.o: $(srcdir)/yap2swi.c $(srcdir)/yap2swi.h
$(CC) -c $(CFLAGS) $(SHLIB_CFLAGS) $(srcdir)/yap2swi.c -o yap2swi.o
@DO_SECOND_LD@@DO_SECOND_LD@%@SHLIB_SUFFIX@: %.o
@DO_SECOND_LD@@DO_SECOND_LD@%.@SHLIB_SUFFIX@: %.o
@DO_SECOND_LD@ @SHLIB_LD@ -o $@ $<
@DO_SECOND_LD@yap2swi@SHLIB_SUFFIX@: yap2swi.o
@DO_SECOND_LD@ @SHLIB_LD@ -o yap2swi@SHLIB_SUFFIX@ yap2swi.o @
@DO_SECOND_LD@yap2swi.@SHLIB_SUFFIX@: yap2swi.o
@DO_SECOND_LD@ @SHLIB_LD@ -o yap2swi.@SHLIB_SUFFIX@ yap2swi.o @
install:
$(INSTALL_PROGRAM) $(SOBJS) $(DESTDIR)$(LIBDIR)

View File

@ -2358,8 +2358,6 @@ typedef struct open_query_struct {
struct open_query_struct *old;
} open_query;
static open_query *execution = NULL;
X_API fid_t
PL_open_foreign_frame(void)
{
@ -2564,6 +2562,7 @@ X_API int PL_thread_self(void)
X_API int PL_thread_attach_engine(const PL_thread_attr_t *attr)
{
int wid = YAP_ThreadSelf();
fprintf(stderr,"attaching new engine %p\n", attr);
if (wid < 0) {
/* we do not have an engine */
@ -2623,7 +2622,7 @@ PL_create_engine(const PL_thread_attr_t *attr)
yapt.tsize = attr->global_size;
yapt.alias = (YAP_Term)attr->alias;
yapt.cancel = attr->cancel;
return (PL_engine_t)YAP_ThreadCreateEngine(&yapt);
return (PL_engine_t)YAP_ThreadCreateEngine(&yapt);
} else {
return (PL_engine_t)YAP_ThreadCreateEngine(NULL);
}

View File

@ -159,6 +159,8 @@ char* putc_cur_buf_ putc_cur_buf =NULL
char* putc_cur_lim_ putc_cur_lim =NULL
UInt putc_cur_flags_ putc_cur_flags =0L
struct open_query_struct* _execution execution =NULL
// Ricardo's stuff
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
struct worker worker WORKER void
@ -169,6 +171,7 @@ struct thandle thread_handle ThreadHandle InitThreadHandle
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)].thread_handle)
#define MY_ThreadHandle (Yap_WLocal[worker_id].thread_handle)
#endif
// END WORKER LOCAL STUFF
END_WORKER_LOCAL