forked from OSchip/llvm-project
[mlir] Link with pthreads in AsyncRuntime
AsyncRuntime must be explicitly linked with LLVM pthreads Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D89983
This commit is contained in:
parent
9f4b888c32
commit
b16f6324db
|
@ -59,7 +59,12 @@ mlirAsyncRuntimeAwaitToken(AsyncToken *token) {
|
||||||
|
|
||||||
extern "C" MLIR_ASYNCRUNTIME_EXPORT void
|
extern "C" MLIR_ASYNCRUNTIME_EXPORT void
|
||||||
mlirAsyncRuntimeExecute(CoroHandle handle, CoroResume resume) {
|
mlirAsyncRuntimeExecute(CoroHandle handle, CoroResume resume) {
|
||||||
|
#if LLVM_ENABLE_THREADS
|
||||||
|
std::thread thread([handle, resume]() { (*resume)(handle); });
|
||||||
|
thread.detach();
|
||||||
|
#else
|
||||||
(*resume)(handle);
|
(*resume)(handle);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" MLIR_ASYNCRUNTIME_EXPORT void
|
extern "C" MLIR_ASYNCRUNTIME_EXPORT void
|
||||||
|
|
|
@ -107,5 +107,6 @@ add_mlir_library(mlir_async_runtime
|
||||||
|
|
||||||
LINK_LIBS PUBLIC
|
LINK_LIBS PUBLIC
|
||||||
mlir_c_runner_utils_static
|
mlir_c_runner_utils_static
|
||||||
|
${LLVM_PTHREAD_LIB}
|
||||||
)
|
)
|
||||||
target_compile_definitions(mlir_async_runtime PRIVATE mlir_async_runtime_EXPORTS)
|
target_compile_definitions(mlir_async_runtime PRIVATE mlir_async_runtime_EXPORTS)
|
||||||
|
|
Loading…
Reference in New Issue