c_inp_stream and friends are thread private!
This commit is contained in:
2
C/init.c
2
C/init.c
@@ -165,8 +165,6 @@ int Yap_CritLocks = 0;
|
||||
|
||||
/********* streams ********************************************/
|
||||
|
||||
int Yap_c_input_stream, Yap_c_output_stream, Yap_c_error_stream;
|
||||
|
||||
YP_FILE *Yap_stdin;
|
||||
YP_FILE *Yap_stdout;
|
||||
YP_FILE *Yap_stderr;
|
||||
|
@@ -81,6 +81,9 @@ store_specs(int new_worker_id, UInt ssize, UInt tsize, UInt sysize, Term *tpgoal
|
||||
FOREIGN_ThreadHandle(new_worker_id).ssize = ssize;
|
||||
FOREIGN_ThreadHandle(new_worker_id).tsize = tsize;
|
||||
FOREIGN_ThreadHandle(new_worker_id).sysize = sysize;
|
||||
FOREIGN_WL(new_worker_id)->c_input_stream = Yap_c_input_stream;
|
||||
FOREIGN_WL(new_worker_id)->c_output_stream = Yap_c_output_stream;
|
||||
FOREIGN_WL(new_worker_id)->c_error_stream = Yap_c_error_stream;
|
||||
pm = (ssize + tsize)*1024;
|
||||
if (!(FOREIGN_ThreadHandle(new_worker_id).stack_address = malloc(pm))) {
|
||||
return FALSE;
|
||||
|
@@ -21,6 +21,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#define Yap_c_input_stream WL->c_input_stream
|
||||
#define Yap_c_output_stream WL->c_output_stream
|
||||
#define Yap_c_error_stream WL->c_error_stream
|
||||
|
||||
#define OldASP WL->rinfo.old_ASP
|
||||
#define OldLCL0 WL->rinfo.old_LCL0
|
||||
|
@@ -22,6 +22,10 @@
|
||||
|
||||
typedef struct worker_local {
|
||||
|
||||
int c_input_stream;
|
||||
int c_output_stream;
|
||||
int c_error_stream;
|
||||
|
||||
restoreinfo rinfo;
|
||||
|
||||
|
||||
|
@@ -22,6 +22,10 @@
|
||||
|
||||
static void InitWorker(int wid) {
|
||||
|
||||
FOREIGN_WL(wid)->c_input_stream = 0;
|
||||
FOREIGN_WL(wid)->c_output_stream = 1;
|
||||
FOREIGN_WL(wid)->c_error_stream = 2;
|
||||
|
||||
FOREIGN_WL(wid)->rinfo.old_ASP = NULL;
|
||||
FOREIGN_WL(wid)->rinfo.old_LCL0 = NULL;
|
||||
FOREIGN_WL(wid)->rinfo.old_TR = NULL;
|
||||
|
@@ -54,6 +54,10 @@ static void RestoreWorker(int wid) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -322,11 +322,6 @@ Term STD_PROTO(Yap_WStringToList,(wchar_t *));
|
||||
Term STD_PROTO(Yap_WStringToListOfAtoms,(wchar_t *));
|
||||
Atom STD_PROTO(Yap_LookupWideAtom,(wchar_t *));
|
||||
|
||||
extern int
|
||||
Yap_c_input_stream,
|
||||
Yap_c_output_stream,
|
||||
Yap_c_error_stream;
|
||||
|
||||
#define YAP_INPUT_STREAM 0x01
|
||||
#define YAP_OUTPUT_STREAM 0x02
|
||||
#define YAP_APPEND_STREAM 0x04
|
||||
|
@@ -20,6 +20,11 @@
|
||||
// Stuff that must be considered local to a thread or worker
|
||||
START_WORKER_LOCAL
|
||||
|
||||
// Streams
|
||||
int c_input_stream Yap_c_input_stream =0
|
||||
int c_output_stream Yap_c_output_stream =1
|
||||
int c_error_stream Yap_c_error_stream =2
|
||||
|
||||
/* shifts and restore: per local data-structure */
|
||||
restoreinfo rinfo
|
||||
. rinfo.old_ASP OldASP =NULL
|
||||
|
Submodule packages/jpl updated: 7c9456b5c9...6e7c68cdcc
Reference in New Issue
Block a user