Fixes races with control thread and signalling:

- Clean up some warnings about not checking return values from read/write.

- Added triggered vars to the threaded_control_mgr to deal with signalling
  before the wait.