Use sched_yield() instead pthread_yield()

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2021-06-28 13:34:15 +02:00
committed by Compute-Runtime-Automation
parent af55117fa0
commit 1d3d32cf39
2 changed files with 6 additions and 3 deletions

View File

@ -27,6 +27,7 @@
#include <iostream>
#include <memory>
#include <mutex>
#include <sched.h>
#include <thread>
using namespace NEO;
@ -121,7 +122,7 @@ TEST_F(DrmGemCloseWorkerTests, GivenMultipleThreadsWhenClosingGemThenSucceeds) {
//wait for worker to complete or deadCnt drops
while (!worker->isEmpty() && (deadCnt-- > 0))
pthread_yield(); //yield to another threads
sched_yield(); //yield to another threads
worker->close(false);
@ -142,7 +143,7 @@ TEST_F(DrmGemCloseWorkerTests, GivenMultipleThreadsAndCloseFalseWhenClosingGemTh
//wait for worker to complete or deadCnt drops
while (!worker->isEmpty() && (deadCnt-- > 0))
pthread_yield(); //yield to another threads
sched_yield(); //yield to another threads
//and check if GEM was closed
EXPECT_EQ(1, this->drmMock->gem_close_cnt.load());