Skip to content

Commit

Permalink
Fix collaborative_call_once compilation
Browse files Browse the repository at this point in the history
Signed-off-by: pavelkumbrasev <[email protected]>
  • Loading branch information
pavelkumbrasev committed Apr 15, 2024
1 parent 5e27eb0 commit 2bce523
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion include/oneapi/tbb/collaborative_call_once.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2021 Intel Corporation
Copyright (c) 2021-2024 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,27 @@ namespace d1 {
#pragma warning (disable: 4324)
#endif

template <typename F>
class function_stack_task : public task {
const F& m_func;
wait_context& m_wait_ctx;

void finalize() {
m_wait_ctx.release();
}
task* execute(d1::execution_data&) override {
task* res = d2::task_ptr_or_nullptr(m_func);
finalize();
return res;
}
task* cancel(d1::execution_data&) override {
finalize();
return nullptr;
}
public:
function_stack_task(const F& f, wait_context& wctx) : m_func(f), m_wait_ctx(wctx) {}
};

constexpr std::uintptr_t collaborative_once_max_references = max_nfs_size;
constexpr std::uintptr_t collaborative_once_references_mask = collaborative_once_max_references-1;

Expand Down

0 comments on commit 2bce523

Please sign in to comment.