Skip to content

Commit c4b1608

Browse files
committed
fix increment ref logic
1 parent 21b97be commit c4b1608

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

unified-runtime/source/adapters/level_zero/adapter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,15 +667,15 @@ ur_result_t urAdapterGet(
667667
uint32_t *NumAdapters) {
668668
if (NumEntries > 0 && Adapters) {
669669
if (GlobalAdapter) {
670-
if (GlobalAdapter->incrementRefCount() == 0) {
670+
if (GlobalAdapter->incrementRefCount() == 1) {
671671
adapterStateInit();
672672
}
673673
} else {
674674
// If the GetAdapter is called after the Library began or was torndown,
675675
// then temporarily create a new Adapter handle and register a new
676676
// cleanup.
677677
GlobalAdapter = new ur_adapter_handle_t_();
678-
if (GlobalAdapter->incrementRefCount() == 0) {
678+
if (GlobalAdapter->incrementRefCount() == 1) {
679679
adapterStateInit();
680680
}
681681
std::atexit(globalAdapterOnDemandCleanup);

0 commit comments

Comments
 (0)