From: Terrance S. <ts...@cs...> - 2005-08-05 13:29:56
|
This is an important question, and one that Rui and I have thought about but decided to postpone until a later time (i.e. now). So yes, there should be both private and shared flags. I'm not sure that current_output should be thread specific though, as threads can always open their own streams, and the mechanisms for stream handling are now quite intricate ... but its worthwhile creating private flags and putting the flags that "obviously" should be private there. I have a telecon with Rui in about 1/2 hour. I'll discuss with him, and then give you a call later on this afternoon. BTW, I am close to getting an check for abolishing tables (and table preds) that checks for completed table choice points in addition to choice points for non-completed tables. Terry On Thu, 4 Aug 2005, David Warren wrote: > Hi Terry, > > I've just tracked down an interesting "bug" in the thread-specific > retract code. Actually retract wouldn't work right whenever there was > more than one thread. > > The problem was the flag CLAUSE_INT. It is used in db_clause to get > the body of a dynamic clause. When that flag is set, the call (and > execute) instructions don't call their arguments but instead call the > _$clause_int/1 predicate. This squirrels away the body term and then > returns to the original caller. In this way the code for the body of > a dynamic clause can be both executed and retrieved. The problem is > that this flag is stored in flags[CLAUSE_INT] and flags[] is global. > So if ever thread-switching occurs when that CLAUSE_INT bit is set, > *bad* things happen. > > So I've hacked a special case for CLAUSE_INT that works, but it seems > to me that some of the flags[] should be private and some global. > Several are related to tracing, and that clearly is specific to a > particular thread. Also, the CURRENT_INPUT, etc., flags should be > specific to a thread, I would think. I guess my question is whether I > should make a more general solution to flags, and support 2 sets of > flags, global and private, and if so, which ones you think should be > private and which shared. > > Thoughts? > > -David > |