40 #define __TBB_STD_RETHROW_EXCEPTION_POSSIBLY_BROKEN \ 41 (__GLIBCXX__ && __TBB_GLIBCXX_VERSION>=40700 && __TBB_GLIBCXX_VERSION<60000 \ 42 && TBB_USE_EXCEPTIONS && !TBB_USE_CAPTURED_EXCEPTION) 44 #if __TBB_STD_RETHROW_EXCEPTION_POSSIBLY_BROKEN 51 const char*
bad_last_alloc::what()
const throw() {
return "bad allocation in previous or concurrent attempt"; }
52 const char*
improper_lock::what()
const throw() {
return "attempted recursive lock on critical section or non-recursive mutex"; }
53 const char*
user_abort::what()
const throw() {
return "User-initiated abort has terminated this operation"; }
55 const char*
missing_wait::what()
const throw() {
return "wait() was not called on the structured_task_group"; }
59 #if TBB_USE_EXCEPTIONS 60 #define DO_THROW(exc, init_args) throw exc init_args; 62 #define PRINT_ERROR_AND_ABORT(exc_name, msg) \ 63 fprintf (stderr, "Exception %s with message %s would've been thrown, " \ 64 "if exception handling were not disabled. Aborting.\n", exc_name, msg); \ 67 #define DO_THROW(exc, init_args) PRINT_ERROR_AND_ABORT(#exc, #init_args) 76 return sysconf(_SC_PAGESIZE);
90 #define snprintf _snprintf 92 int written = snprintf(buf,
sizeof(buf),
"%s: %s", what, strerror( error_code ));
94 __TBB_ASSERT_EX( written>0 && written<(
int)
sizeof(buf),
"Error description is too long" );
96 buf[
sizeof(buf)-1] = 0;
97 #if TBB_USE_EXCEPTIONS 98 throw std::runtime_error(buf);
107 #if !__TBB_WIN8UI_SUPPORT 108 FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
109 NULL, error_code, 0, buf,
sizeof(buf), NULL );
112 sprintf_s((
char*)&buf, 512,
"error code %d", error_code);
114 #if TBB_USE_EXCEPTIONS 115 throw std::runtime_error(buf);
120 #endif // _WIN32||_WIN64 142 case eid_reserved:
DO_THROW(std::out_of_range, (
"[backward compatibility] Invalid number of buckets") );
148 #if __TBB_SUPPORTS_WORKERS_WAITING_IN_TERMINATE 149 case eid_blocking_thread_join_impossible:
DO_THROW(std::runtime_error, (
"Blocking terminate failed") );
153 #if !TBB_USE_EXCEPTIONS && __APPLE__ 157 invalid_argument e4(
"");
161 #if __TBB_STD_RETHROW_EXCEPTION_POSSIBLY_BROKEN 170 void * caughtExceptions;
171 unsigned int uncaughtExceptions;
173 gcc_eh_data* eh_data = punned_cast<gcc_eh_data*>( abi::__cxa_get_globals() );
174 ++eh_data->uncaughtExceptions;
180 "gcc_rethrow_exception_broken() must not be called when an exception is active" );
184 throw __TBB_GLIBCXX_VERSION;
186 std::rethrow_exception( std::current_exception() );
190 is_broken = std::uncaught_exception();
213 char str[1024]; memset(str, 0, 1024);
214 va_list args; va_start(args, format);
216 vsnprintf( str, 1024-1, format, args);
218 fprintf(stderr,
"TBB: %s\t%s\n", category, str );
231 #if __TBB_TSX_AVAILABLE 232 #if (__INTEL_COMPILER || __GNUC__ || _MSC_VER || __SUNPRO_CC) 234 const int rtm_ebx_mask = 1<<11;
236 int info[4] = {0,0,0,0};
237 const int reg_ebx = 1;
238 __cpuidex(info, 7, 0);
239 result = (info[reg_ebx] & rtm_ebx_mask)!=0;
240 #elif __GNUC__ || __SUNPRO_CC 244 __asm__ __volatile__ (
"movl %%ebx, %%esi\n" 247 "movl %%esi, %%ebx\n" 248 :
"=a"(reg_ebx) :
"0" (reg_eax),
"c" (reg_ecx) :
"esi",
254 result = (reg_ebx & rtm_ebx_mask)!=0 ;
258 #error Speculation detection not enabled for compiler 273 #if !__TBB_RML_STATIC 280 using tbb::internal::int64_t;
286 const unsigned n = 4;
287 static tbb::atomic<void*> cache[n];
288 static tbb::atomic<unsigned> k;
289 for(
unsigned i=0; i<n; ++i )
292 cache[(k++)%n] = const_cast<void*>(ptr);
300 int64_t tmp = *(int64_t*)ptr;
The last enumerator tracks the number of defined IDs. It must remain the last one.
void __TBB_EXPORTED_FUNC throw_exception_v4(exception_id)
Gathers all throw operators in one place.
bool gcc_rethrow_exception_broken()
int __TBB_EXPORTED_FUNC TBB_runtime_interface_version()
The function returns the interface version of the TBB shared library being used.
Exception for concurrent containers.
bool cpu_has_speculation()
check for transaction support.
size_t DefaultSystemPageSize()
Returns OS regular memory page size.
const char * what() const __TBB_override
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.
Exception for user-initiated abort.
void pause()
Pause for a while.
void PrintVersion()
Prints TBB version information on stderr.
bool __TBB_TryLockByte(__TBB_atomic_flag &flag)
const char * what() const __TBB_override
#define PRINT_ERROR_AND_ABORT(exc_name, msg)
#define TBB_VERSION_STRINGS
void __TBB_machine_store8_slow_perf_warning(volatile void *ptr)
const char * what() const __TBB_override
#define TBB_INTERFACE_VERSION
#define __TBB_machine_cmpswp8
Exception for repeated scheduling of the same task_handle.
void PrintRMLVersionInfo(void *arg, const char *server_info)
A callback routine to print RML version information on stderr.
const char * what() const __TBB_override
#define __TBB_ASSERT_EX(predicate, comment)
"Extended" version is useful to suppress warnings if a variable is only used with an assert
Exception for missing wait on structured_task_group.
Class that implements exponential backoff.
static const char VersionString[]
void __TBB_machine_store8_slow(volatile void *ptr, int64_t value)
Handles misaligned 8-byte store.
#define DO_THROW(exc, init_args)
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
void __TBB_EXPORTED_FUNC throw_bad_last_alloc_exception_v4()
Obsolete.
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
void fix_broken_rethrow()
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.
const char * what() const __TBB_override
void PrintExtraVersionInfo(const char *category, const char *format,...)
Prints arbitrary extra TBB version information on stderr.
int64_t __TBB_machine_lockbyte(volatile unsigned char &ptr)
static bool PrintVersionFlag