Changeset 9afebe1 in sasview for src/sans


Ignore:
Timestamp:
Aug 12, 2014 10:00:27 PM (10 years ago)
Author:
butler
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
f4167637
Parents:
eb9fc6d
Message:

patch to Calc1D and Calc2D to deal with problem of threads not handling a stop thread properly causing 2 threads to trample on each other. Thread issues in general may be at the heart of many of our instabilities and should be investigated further.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sans/perspectives/fitting/fitting.py

    r767514a r9afebe1  
    19591959            if (self.calc_2D is not None) and self.calc_2D.isrunning(): 
    19601960                self.calc_2D.stop() 
     1961                ## stop just raises a flag to tell the thread to kill 
     1962                ## itself -- see the fix in Calc1D implemented to fix 
     1963                ## an actual problem.  Seems the fix should also go here 
     1964                ## and may be the cause of other noted instabilities 
     1965                ## 
     1966                ##    -PDB August 12, 2014  
     1967                while self.calc_2D.isrunning(): 
     1968                    time.sleep(0.1) 
    19611969            self.calc_2D = Calc2D(model=model, 
    19621970                                    data=data, 
     
    19962004            if (self.calc_1D is not None) and self.calc_1D.isrunning(): 
    19972005                self.calc_1D.stop() 
     2006                ## stop just raises the flag -- the thread is supposed to  
     2007                ## then kill itself but cannot.  Paul Kienzle came up with 
     2008                ## this fix to prevent threads from stepping on each other 
     2009                ## which was causing a simple custom model to crash Sasview. 
     2010                ## We still don't know why the fit sometimes lauched a second 
     2011                ## thread -- something which should also be investigated. 
     2012                ## The thread approach was implemented in order to be able 
     2013                ## to lauch a computation in a separate thread from the GUI so 
     2014                ## that the GUI can still respond to user input including 
     2015                ## a request to stop the computation. 
     2016                ## It seems thus that the whole thread approach used here 
     2017                ## May need rethinking   
     2018                ## 
     2019                ##    -PDB August 12, 2014                   
     2020                while self.calc_1D.isrunning(): 
     2021                    time.sleep(0.1) 
    19982022            self.calc_1D = Calc1D(data=data, 
    19992023                                  model=model, 
Note: See TracChangeset for help on using the changeset viewer.