document thread functions