Add thread support but is not ready to work.