Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-30 08:46:16

0001 /*
0002     Copyright (c) 2005-2021 Intel Corporation
0003 
0004     Licensed under the Apache License, Version 2.0 (the "License");
0005     you may not use this file except in compliance with the License.
0006     You may obtain a copy of the License at
0007 
0008         http://www.apache.org/licenses/LICENSE-2.0
0009 
0010     Unless required by applicable law or agreed to in writing, software
0011     distributed under the License is distributed on an "AS IS" BASIS,
0012     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013     See the License for the specific language governing permissions and
0014     limitations under the License.
0015 */
0016 
0017 #ifndef __TBB__exception_H
0018 #define __TBB__exception_H
0019 
0020 #include "_config.h"
0021 
0022 #include <new>          // std::bad_alloc
0023 #include <exception>    // std::exception
0024 #include <stdexcept>    // std::runtime_error
0025 
0026 namespace tbb {
0027 namespace detail {
0028 inline namespace d0 {
0029 enum class exception_id {
0030     bad_alloc = 1,
0031     bad_last_alloc,
0032     user_abort,
0033     nonpositive_step,
0034     out_of_range,
0035     reservation_length_error,
0036     missing_wait,
0037     invalid_load_factor,
0038     invalid_key,
0039     bad_tagged_msg_cast,
0040     unsafe_wait,
0041     last_entry
0042 };
0043 } // namespace d0
0044 
0045 #if _MSC_VER
0046     #pragma warning(disable: 4275)
0047 #endif
0048 
0049 namespace r1 {
0050 //! Exception for concurrent containers
0051 class TBB_EXPORT bad_last_alloc : public std::bad_alloc {
0052 public:
0053     const char* __TBB_EXPORTED_METHOD what() const noexcept(true) override;
0054 };
0055 
0056 //! Exception for user-initiated abort
0057 class TBB_EXPORT user_abort : public std::exception {
0058 public:
0059     const char* __TBB_EXPORTED_METHOD what() const noexcept(true) override;
0060 };
0061 
0062 //! Exception for missing wait on structured_task_group
0063 class TBB_EXPORT missing_wait : public std::exception {
0064 public:
0065     const char* __TBB_EXPORTED_METHOD what() const noexcept(true) override;
0066 };
0067 
0068 //! Exception for impossible finalization of task_sheduler_handle
0069 class TBB_EXPORT unsafe_wait : public std::runtime_error {
0070 public:
0071     unsafe_wait(const char* msg) : std::runtime_error(msg) {}
0072 };
0073 
0074 //! Gathers all throw operators in one place.
0075 /** Its purpose is to minimize code bloat that can be caused by throw operators
0076     scattered in multiple places, especially in templates. **/
0077 TBB_EXPORT void __TBB_EXPORTED_FUNC throw_exception ( exception_id );
0078 } // namespace r1
0079 
0080 inline namespace d0 {
0081 using r1::throw_exception;
0082 } // namespace d0
0083 
0084 } // namespace detail
0085 } // namespace tbb
0086 
0087 #endif // __TBB__exception_H
0088