1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-09-24 04:41:54 +01:00
Files
devlib/devlib/utils
Brendan Jackman 8cf4a44bd7 utils/android: Fix race condition in LogcatMonitor
If you call .start then immediately call .stop, the thread may not
yet have set ._logcat, resulting in an AttributeError.

I initially fixed this by setting _logcat = None in __init__, then putting the
`kill` calls inside `if self._logcat`. The problem with this, as pointed out by
@valschneider, is that we can then have this sequence:

 main thread:                          monitor thread

 stop()                                run()
   if self._logcat:                      .
     # False, don't kill process         .
   join()                                .
                                         self._logcat = <...>

Therefore, just have the stop() method wait until the process is started before
unconditionally killing it.
2017-09-20 14:06:34 +01:00
..
2015-10-09 09:30:04 +01:00
2017-07-20 14:24:07 +01:00
2015-10-09 09:30:04 +01:00
2015-10-09 09:30:04 +01:00