move out threads cases to cpp-code