36 #define __TBB_STD_RETHROW_EXCEPTION_POSSIBLY_BROKEN \ 37 (__GLIBCXX__ && __TBB_GLIBCXX_VERSION>=40700 && __TBB_GLIBCXX_VERSION<60000 \ 38 && TBB_USE_EXCEPTIONS && !TBB_USE_CAPTURED_EXCEPTION) 40 #if __TBB_STD_RETHROW_EXCEPTION_POSSIBLY_BROKEN 47 const char*
bad_last_alloc::what()
const throw() {
return "bad allocation in previous or concurrent attempt"; }
48 const char*
improper_lock::what()
const throw() {
return "attempted recursive lock on critical section or non-recursive mutex"; }
49 const char*
user_abort::what()
const throw() {
return "User-initiated abort has terminated this operation"; }
51 const char*
missing_wait::what()
const throw() {
return "wait() was not called on the structured_task_group"; }
55 #if TBB_USE_EXCEPTIONS 56 #define DO_THROW(exc, init_args) throw exc init_args; 58 #define PRINT_ERROR_AND_ABORT(exc_name, msg) \ 59 fprintf (stderr, "Exception %s with message %s would've been thrown, " \ 60 "if exception handling were not disabled. Aborting.\n", exc_name, msg); \ 63 #define DO_THROW(exc, init_args) PRINT_ERROR_AND_ABORT(#exc, #init_args) 77 #define snprintf _snprintf 79 int written = snprintf(buf,
sizeof(buf),
"%s: %s", what, strerror( error_code ));
81 __TBB_ASSERT_EX( written>0 && written<(
int)
sizeof(buf),
"Error description is too long" );
83 buf[
sizeof(buf)-1] = 0;
84 #if TBB_USE_EXCEPTIONS 85 throw std::runtime_error(buf);
94 #if !__TBB_WIN8UI_SUPPORT 95 FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
96 NULL, error_code, 0, buf,
sizeof(buf), NULL );
99 sprintf_s((
char*)&buf, 512,
"error code %d", error_code);
101 #if TBB_USE_EXCEPTIONS 102 throw std::runtime_error(buf);
107 #endif // _WIN32||_WIN64 129 case eid_reserved:
DO_THROW(std::out_of_range, (
"[backward compatibility] Invalid number of buckets") );
135 #if __TBB_SUPPORTS_WORKERS_WAITING_IN_TERMINATE 136 case eid_blocking_thread_join_impossible:
DO_THROW(std::runtime_error, (
"Blocking terminate failed") );
140 #if !TBB_USE_EXCEPTIONS && __APPLE__ 144 invalid_argument e4(
"");
148 #if __TBB_STD_RETHROW_EXCEPTION_POSSIBLY_BROKEN 157 void * caughtExceptions;
158 unsigned int uncaughtExceptions;
160 gcc_eh_data* eh_data =
punned_cast<gcc_eh_data*>( abi::__cxa_get_globals() );
161 ++eh_data->uncaughtExceptions;
167 "gcc_rethrow_exception_broken() must not be called when an exception is active" );
171 throw __TBB_GLIBCXX_VERSION;
173 std::rethrow_exception( std::current_exception() );
177 is_broken = std::uncaught_exception();
194 PrintVersionFlag =
true;
195 fputs(VersionString+1,stderr);
199 if( PrintVersionFlag ) {
200 char str[1024]; memset(str, 0, 1024);
201 va_list args; va_start(args, format);
203 vsnprintf( str, 1024-1, format, args);
205 fprintf(stderr,
"TBB: %s\t%s\n", category, str );
218 #if __TBB_TSX_AVAILABLE 219 #if (__INTEL_COMPILER || __GNUC__ || _MSC_VER || __SUNPRO_CC) 221 const int rtm_ebx_mask = 1<<11;
223 int info[4] = {0,0,0,0};
224 const int reg_ebx = 1;
225 __cpuidex(info, 7, 0);
226 result = (info[reg_ebx] & rtm_ebx_mask)!=0;
227 #elif __GNUC__ || __SUNPRO_CC 231 __asm__ __volatile__ (
"movl %%ebx, %%esi\n" 234 "movl %%esi, %%ebx\n" 235 :
"=a"(reg_ebx) :
"0" (reg_eax),
"c" (reg_ecx) :
"esi",
241 result = (reg_ebx & rtm_ebx_mask)!=0 ;
245 #error Speculation detection not enabled for compiler 260 #if !__TBB_RML_STATIC 267 using tbb::internal::int64_t;
273 const unsigned n = 4;
276 for(
unsigned i=0; i<n; ++i )
279 cache[(k++)%n] = const_cast<void*>(ptr);
287 int64_t tmp = *(int64_t*)ptr;
bool __TBB_TryLockByte(__TBB_atomic_flag &flag)
The last enumerator tracks the number of defined IDs. It must remain the last one.
#define TBB_VERSION_STRINGS
void __TBB_machine_store8_slow_perf_warning(volatile void *ptr)
void __TBB_EXPORTED_FUNC throw_bad_last_alloc_exception_v4()
Obsolete.
const char * what() const __TBB_override
#define DO_THROW(exc, init_args)
Class that implements exponential backoff.
static const char VersionString[]
static bool PrintVersionFlag
void __TBB_machine_store8_slow(volatile void *ptr, int64_t value)
Handles misaligned 8-byte store.
void PrintVersion()
Prints TBB version information on stderr.
void __TBB_EXPORTED_FUNC handle_perror(int error_code, const char *aux_info)
Throws std::runtime_error with what() returning error_code description prefixed with aux_info...
void fix_broken_rethrow()
void pause()
Pause for a while.
bool gcc_rethrow_exception_broken()
void __TBB_EXPORTED_FUNC throw_exception_v4(exception_id)
Gathers all throw operators in one place.
bool cpu_has_speculation()
check for transaction support.
int64_t __TBB_machine_lockbyte(volatile unsigned char &ptr)
const char * what() const __TBB_override
Exception for repeated scheduling of the same task_handle.
#define __TBB_machine_cmpswp8
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
T punned_cast(U *ptr)
Cast between unrelated pointer types.
void handle_win_error(int error_code)
Throws std::runtime_error with what() returning error_code description prefixed with aux_info...
void __TBB_EXPORTED_FUNC runtime_warning(const char *format,...)
Report a runtime warning.
void PrintExtraVersionInfo(const char *category, const char *format,...)
Prints arbitrary extra TBB version information on stderr.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
const char * what() const __TBB_override
#define TBB_INTERFACE_VERSION
#define __TBB_ASSERT_EX(predicate, comment)
"Extended" version is useful to suppress warnings if a variable is only used with an assert ...
const char * what() const __TBB_override
Specialization for atomic<void*>, for sake of not allowing arithmetic or operator->.
int __TBB_EXPORTED_FUNC TBB_runtime_interface_version()
The function returns the interface version of the TBB shared library being used.
Exception for missing wait on structured_task_group.
#define PRINT_ERROR_AND_ABORT(exc_name, msg)
Exception for concurrent containers.
const char * what() const __TBB_override
void PrintRMLVersionInfo(void *arg, const char *server_info)
A callback routine to print RML version information on stderr.
Exception for user-initiated abort.