Add exception safety to Runtime::Acquire.

Change-Id: Ia2a9baf08bb56971412f1ac3914592612de5f134
이 커밋은 다음에 포함됨:
Sean Keely가 2018-02-28 05:21:07 -06:00를 커밋했습니다
1 부모 81c923b26f
커밋 31c05d2fc7
1 파일이 변경됨
+2 -1
+2 -1
파일 보기
@@ -108,16 +108,17 @@ hsa_status_t Runtime::Acquire() {
}
runtime_singleton_->ref_count_++;
MAKE_NAMED_SCOPE_GUARD(refGuard, [&]() { runtime_singleton_->ref_count_--; });
if (runtime_singleton_->ref_count_ == 1) {
hsa_status_t status = runtime_singleton_->Load();
if (status != HSA_STATUS_SUCCESS) {
runtime_singleton_->ref_count_--;
return HSA_STATUS_ERROR_OUT_OF_RESOURCES;
}
}
refGuard.Dismiss();
return HSA_STATUS_SUCCESS;
}