[atomic] Add hb_atomic_ptr_t<> and port all uses Found and fixed a couple bugs. Found a couple multithreading issues. Marked them with "XXX-MT-bug".