Diff

Differences From Artifact [2fbbb1d1a2]:

To Artifact [65feda12d8]:


   253    253   /*
   254    254    * Return the thread-specific Tcl interpreter, creating it if needed
   255    255    */
   256    256   static Tcl_Interp *appfs_TclInterp(void) {
   257    257   	Tcl_Interp *interp;
   258    258   	int pthread_ret;
   259    259   	static __thread int thread_interp_reset_key = 0;
          260  +	int global_interp_reset_key;
          261  +
          262  +	global_interp_reset_key = __sync_fetch_and_add(&interp_reset_key, 0);
   260    263   
   261    264   	interp = pthread_getspecific(interpKey);
   262         -	if (interp != NULL && thread_interp_reset_key != interp_reset_key) {
          265  +	if (interp != NULL && thread_interp_reset_key != global_interp_reset_key) {
   263    266   		APPFS_DEBUG("Terminating old interpreter and restarting due to reset request.");
   264    267   
   265    268   		Tcl_DeleteInterp(interp);
   266    269   
   267    270   		interp = NULL;
          271  +
          272  +		thread_interp_reset_key = global_interp_reset_key;
   268    273   	}
   269    274   
   270    275   	if (interp == NULL) {
   271    276   		interp = appfs_create_TclInterp(NULL);
   272    277   
   273    278   		if (interp == NULL) {
   274    279   			return(NULL);