threads: add is_complete() helper function