mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	target: Fix deadlock in Target.clear_logcat()
Ensure that only once clear_logcat() call is active at once, and just ignore reentrant calls.
This commit is contained in:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							b64ec714a0
						
					
				
				
					commit
					f523afda95
				
			@@ -1759,11 +1759,15 @@ class AndroidTarget(Target):
 | 
			
		||||
            self.remove(dev_path)
 | 
			
		||||
 | 
			
		||||
    def clear_logcat(self):
 | 
			
		||||
        with self.clear_logcat_lock:
 | 
			
		||||
        locked = self.clear_logcat_lock.acquire(blocking=False)
 | 
			
		||||
        if locked:
 | 
			
		||||
            try:
 | 
			
		||||
                if isinstance(self.conn, AdbConnection):
 | 
			
		||||
                    adb_command(self.adb_name, 'logcat -c', timeout=30, adb_server=self.adb_server)
 | 
			
		||||
                else:
 | 
			
		||||
                    self.execute('logcat -c', timeout=30)
 | 
			
		||||
            finally:
 | 
			
		||||
                self.clear_logcat_lock.release()
 | 
			
		||||
 | 
			
		||||
    def get_logcat_monitor(self, regexps=None):
 | 
			
		||||
        return LogcatMonitor(self, regexps)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user