mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Use sched_yield() instead pthread_yield()
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
af55117fa0
commit
1d3d32cf39
@@ -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());
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "shared/source/os_interface/linux/os_thread_linux.h"
|
||||
|
||||
#include <sched.h>
|
||||
|
||||
namespace NEO {
|
||||
ThreadLinux::ThreadLinux(pthread_t threadId) : threadId(threadId){};
|
||||
|
||||
@@ -21,7 +23,7 @@ void ThreadLinux::join() {
|
||||
}
|
||||
|
||||
void ThreadLinux::yield() {
|
||||
pthread_yield();
|
||||
sched_yield();
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user