kernel/timeout: Fix "not in list" predication in timeout handling
kernel/timeout: Fix "not in list" predication in timeout handling

The use of dticks == INACTIVE to tell whether or not a timeout was
already in the list was insufficient.  There is a time period between
the moment a timeout is removed from the list and the end of its
handler where it is not in the list, yet its list node pointers still
point into it.  Doing things like aborting a thread while that is true
(which can be asynchronous too!)  would corrupt the list even though
all the operations on it were "atomic".

Set the timeout node pointers to nulls atomically when removed, and
check for double-remove conditions (which, again, might be perfectly
OK).

Signed-off-by: Andy Ross <c70f9a6bf6ee0cd69c8af4ce5e6b131945769315@intel.com>

finikorg/zephyr,punitvara/zephyr,nashif/zephyr,Vudentz/zephyr,GiulianoFranchetto/zephyr,GiulianoFranchetto/zephyr,ldts/zephyr,punitvara/zephyr,explora26/zephyr,punitvara/zephyr,zephyrproject-rtos/zephyr,explora26/zephyr,ldts/zephyr,ldts/zephyr,punitvara/zephyr,nashif/zephyr,galak/zephyr,galak/zephyr,GiulianoFranchetto/zephyr,finikorg/zephyr,Vudentz/zephyr,explora26/zephyr,GiulianoFranchetto/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,explora26/zephyr,Vudentz/zephyr,nashif/zephyr,galak/zephyr,finikorg/zephyr,finikorg/zephyr,galak/zephyr,galak/zephyr,Vudentz/zephyr,finikorg/zephyr,ldts/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,Vudentz/zephyr,punitvara/zephyr,GiulianoFranchetto/zephyr,zephyrproject-rtos/zephyr,Vudentz/zephyr,explora26/zephyr,zephyrproject-rtos/zephyr,ldts/zephyr