[core] Add threading class.