diff --git a/runtime/hsa-runtime/core/util/lnx/os_linux.cpp b/runtime/hsa-runtime/core/util/lnx/os_linux.cpp index da82175184..c6d90f7657 100644 --- a/runtime/hsa-runtime/core/util/lnx/os_linux.cpp +++ b/runtime/hsa-runtime/core/util/lnx/os_linux.cpp @@ -574,12 +574,11 @@ int WaitForOsEvent(EventHandle event, unsigned int milli_seconds) { // Timeout return 1; } + } else { + pthread_mutex_lock(&eventDescrp->mutex); } int ret_code = 0; - if(milli_seconds != 0) { - pthread_mutex_lock(&eventDescrp->mutex); - } if (!eventDescrp->state) { if (milli_seconds == 0) {