mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-30 17:50:46 +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:
parent
b64ec714a0
commit
f523afda95
@ -1759,11 +1759,15 @@ class AndroidTarget(Target):
|
||||
self.remove(dev_path)
|
||||
|
||||
def clear_logcat(self):
|
||||
with self.clear_logcat_lock:
|
||||
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)
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user