ros / rosconsole

17 stars 61 forks source link

Is rosconsole thread safe? #60

Open qlibp opened 1 year ago

qlibp commented 1 year ago

As I skim throw the code, I got that we don't have read-lock when performing logs.

This operation is safe if we don't dynamically change the log level at runtime via checkLogLocationEnabledNoLock(). But if we do, we have no read-lock to synchronize the loggerenabled flag.

The reason to do this, I guess, is that even if the flag is not synchronized, the few missing logs is not a problem, compared to the performance hurt with read-lock on every log. Could you guys elaborate more in detail?