mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 05:20:06 +00:00 
			
		
		
		
	Create sweep mutex to eliminate race condition between ComputeSweep() and UpdateSweep()
This commit is contained in:
		
							parent
							
								
									b2fbfa0dee
								
							
						
					
					
						commit
						4c6a40140b
					
				
					 4 changed files with 26 additions and 5 deletions
				
			
		|  | @ -148,8 +148,6 @@ void RadarProductLayer::UpdateSweep() | |||
| { | ||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdateSweep()"; | ||||
| 
 | ||||
|    p->sweepNeedsUpdate_ = false; | ||||
| 
 | ||||
|    gl::OpenGLFunctions& gl = context()->gl_; | ||||
| 
 | ||||
|    boost::timer::cpu_timer timer; | ||||
|  | @ -157,6 +155,17 @@ void RadarProductLayer::UpdateSweep() | |||
|    std::shared_ptr<view::RadarProductView> radarProductView = | ||||
|       context()->radarProductView_; | ||||
| 
 | ||||
|    std::unique_lock sweepLock(radarProductView->sweep_mutex(), | ||||
|                               std::try_to_lock); | ||||
|    if (!sweepLock.owns_lock()) | ||||
|    { | ||||
|       BOOST_LOG_TRIVIAL(debug) | ||||
|          << logPrefix_ << "Sweep locked, deferring update"; | ||||
|       return; | ||||
|    } | ||||
| 
 | ||||
|    p->sweepNeedsUpdate_ = false; | ||||
| 
 | ||||
|    const std::vector<float>& vertices = radarProductView->vertices(); | ||||
| 
 | ||||
|    // Bind a vertex array object
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat