mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 09:58:54 +00:00
ff1747347e
* InterruptableRunnable RunnerInterruptPoint redesign There were several inefficiencies in the old version of RunnerInterruptPoint and InterruptableRunnable. 1) RunnerInterruptPoint was throwing the exception when interrupted, however, the exception was always ignored. 2) InterruptableRunnable used the read-write lock, however only write lock was used. 3) InterruptableRunnable InterruptableRunnable, stored almost similar variable stop_, interrupted_. 4) std::atomic<bool> interrupted_ was used with locks, even though it was accessed by default safest access mode memory_order_seq_cst. So no additional cache invalidation was needed. 5) InterruptableRunnable contained code(in method interrupted() and variables bypass_check_, checked) just for testing. Which was slowing down method interrupted(). 6) Some more confusing things. notify_all was not needed, as only one thread could be waiting for the conditional variable. RunnerInterruptPoint:: pause(void) looks ambiguous and that's why was not used anywhere. I resolved all these problems by merging InterruptableRunnable and RunnerInterruptPoint into the InterruptableRunnable. 1) No use of the exception. 2) 4) Simple mutex, which is only used for pauseMilli. InterruptableRunnable::interrupted and InterruptableRunnable::interrupt function lock-free. 3) Single variable interrupted_. 5) Made InterruptableRunnable::interrupt virtual. Tests override interrupt to make things testable. 6) change to notify_one and removed pause without the specific time. |
||
---|---|---|
.. | ||
carver | ||
config | ||
core | ||
database | ||
devtools | ||
dispatcher | ||
distributed | ||
events | ||
examples | ||
extensions | ||
filesystem | ||
logger | ||
main | ||
registry | ||
remote | ||
sql | ||
tables | ||
tests | ||
utils | ||
CMakeLists.txt |