worker_id may not be initialised if we start from C-level.
This commit is contained in:
parent
62aa6df644
commit
9e63e83f1f
@ -4786,6 +4786,7 @@ struct PL_local_data *Yap_InitThreadIO(int wid)
|
||||
{
|
||||
CACHE_REGS
|
||||
struct PL_local_data *p;
|
||||
fprintf(stderr,"wid=%d\n", wid);
|
||||
if (wid)
|
||||
p = (struct PL_local_data *)malloc(sizeof(struct PL_local_data));
|
||||
else
|
||||
@ -4796,10 +4797,10 @@ struct PL_local_data *Yap_InitThreadIO(int wid)
|
||||
}
|
||||
#if THREADS
|
||||
if (wid) {
|
||||
/* copy from other worker */
|
||||
memcpy(p, Yap_local[worker_id]->PL_local_data_p_, sizeof(struct PL_local_data));
|
||||
memcpy(p, Yap_local[0]->PL_local_data_p_, sizeof(struct PL_local_data));
|
||||
}
|
||||
#endif
|
||||
fprintf(stderr,"wid=%d done\n", wid);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user