handle thread and uithread