mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Create os specific thread implementation
Change-Id: I267d6cb021a75713c28a7bbf29384da13d2a7217
This commit is contained in:
committed by
sys_ocldev
parent
c104db1d5e
commit
09e4dab4f6
@@ -47,6 +47,8 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_library.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_library.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_socket.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_thread_win.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_thread_win.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_time.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_time.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_win.cpp
|
||||
|
||||
36
runtime/os_interface/windows/os_thread_win.cpp
Normal file
36
runtime/os_interface/windows/os_thread_win.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/windows/os_thread_win.h"
|
||||
namespace OCLRT {
|
||||
ThreadWin::ThreadWin(std::thread *thread) {
|
||||
this->thread.reset(thread);
|
||||
};
|
||||
|
||||
std::unique_ptr<Thread> Thread::create(void *(*func)(void *), void *arg) {
|
||||
return std::unique_ptr<Thread>(new ThreadWin(new std::thread(func, arg)));
|
||||
}
|
||||
|
||||
void ThreadWin::join() {
|
||||
thread->join();
|
||||
}
|
||||
}
|
||||
35
runtime/os_interface/windows/os_thread_win.h
Normal file
35
runtime/os_interface/windows/os_thread_win.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/os_thread.h"
|
||||
#include <thread>
|
||||
|
||||
namespace OCLRT {
|
||||
class ThreadWin : public Thread {
|
||||
public:
|
||||
ThreadWin(std::thread *thread);
|
||||
void join() override;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<std::thread> thread;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user