Cross platform perform on ui thread in cpp