threads: add id_to_int() and int_to_id() inline functions