Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task_scheduler_handle productization #566

Merged
merged 13 commits into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 0 additions & 165 deletions doc/main/reference/blocking_terminate.rst

This file was deleted.

1 change: 0 additions & 1 deletion doc/main/reference/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ The key properties of a preview feature are:
:titlesonly:

type_specified_message_keys
blocking_terminate
scalable_memory_pools
helpers_for_expressing_graphs
concurrent_lru_cache_cls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,11 @@ allows waiting for oneTBB worker threads completion:

.. code:: cpp

#define TBB_PREVIEW_WAITING_FOR_WORKERS 1
#include <oneapi/tbb/global_control.h>
#include <oneapi/tbb/parallel_for.h>

int main() {
oneapi::tbb::task_scheduler_handle handle = oneapi::tbb::task_scheduler_handle::get();
oneapi::tbb::task_scheduler_handle handle{tbb::attach{}};
// Do some parallel work here
oneapi::tbb::parallel_for(/* ... */);
oneapi::tbb::finalize(handle);
Expand Down
32 changes: 32 additions & 0 deletions include/oneapi/tbb/detail/_attach.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright (c) 2021 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef __TBB_detail__attach_H
#define __TBB_detail__attach_H

#include "_config.h"

namespace tbb {
namespace detail {
namespace d1 {

struct attach {};

} // namespace d1
} // namespace detail
} // namespace tbb

#endif // __TBB_detail__attach_H
4 changes: 0 additions & 4 deletions include/oneapi/tbb/detail/_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,6 @@
#define __TBB_ARENA_BINDING 1
#endif

#if TBB_PREVIEW_WAITING_FOR_WORKERS || __TBB_BUILD
#define __TBB_SUPPORTS_WORKERS_WAITING_IN_TERMINATE 1
#endif

#if (TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION || __TBB_BUILD) && __TBB_ARENA_BINDING
#define __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT 1
#endif
Expand Down
6 changes: 1 addition & 5 deletions include/oneapi/tbb/detail/_exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@

#include <new> // std::bad_alloc
#include <exception> // std::exception
#if __TBB_SUPPORTS_WORKERS_WAITING_IN_TERMINATE
#include <stdexcept> // std::runtime_error
#endif

namespace tbb {
namespace detail {
Expand Down Expand Up @@ -67,13 +65,11 @@ class TBB_EXPORT missing_wait : public std::exception {
const char* __TBB_EXPORTED_METHOD what() const noexcept(true) override;
};

#if __TBB_SUPPORTS_WORKERS_WAITING_IN_TERMINATE
//! Exception for impossible finalization of task_sheduler_handle
class unsafe_wait : public std::runtime_error {
class TBB_EXPORT unsafe_wait : public std::runtime_error {
public:
unsafe_wait(const char* msg) : std::runtime_error(msg) {}
};
#endif // __TBB_SUPPORTS_WORKERS_WAITING_IN_TERMINATE

//! Gathers all throw operators in one place.
/** Its purpose is to minimize code bloat that can be caused by throw operators
Expand Down
Loading