fixed hypothetical bug with nonatomicy of

if(*state_p == STATE_RUNNING) {...} and select(...)