Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
Go to the documentation of this file.
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;
Exception for concurrent containers.
Exception for repeated scheduling of the same task_handle.
#define TBB_VERSION_STRINGS
static const char VersionString[]
@ eid_condvar_wait_failed
#define DO_THROW(exc, init_args)
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Exception for user-initiated abort.
@ eid_operation_not_permitted
#define TBB_INTERFACE_VERSION
@ eid_segment_range_error
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 handle_win_error(int error_code)
Throws std::runtime_error with what() returning error_code description prefixed with aux_info.
void __TBB_EXPORTED_FUNC throw_exception_v4(exception_id)
Gathers all throw operators in one place.
void __TBB_EXPORTED_FUNC runtime_warning(const char *format,...)
Report a runtime warning.
bool cpu_has_speculation()
check for transaction support.
const char * what() const __TBB_override
void __TBB_EXPORTED_FUNC throw_bad_last_alloc_exception_v4()
Obsolete.
int __TBB_EXPORTED_FUNC TBB_runtime_interface_version()
The function returns the interface version of the TBB shared library being used.
int64_t __TBB_machine_lockbyte(volatile unsigned char &ptr)
const char * what() const __TBB_override
const char * what() const __TBB_override
bool __TBB_TryLockByte(__TBB_atomic_flag &flag)
@ eid_bad_tagged_msg_cast
static bool PrintVersionFlag
void pause()
Pause for a while.
void fix_broken_rethrow()
Class that implements exponential backoff.
bool gcc_rethrow_exception_broken()
void PrintVersion()
Prints TBB version information on stderr.
const char * what() const __TBB_override
Exception for missing wait on structured_task_group.
#define __TBB_machine_cmpswp8
void __TBB_machine_store8_slow(volatile void *ptr, int64_t value)
Handles misaligned 8-byte store.
void __TBB_machine_store8_slow_perf_warning(volatile void *ptr)
void PrintRMLVersionInfo(void *arg, const char *server_info)
A callback routine to print RML version information on stderr.
size_t DefaultSystemPageSize()
Returns OS regular memory page size.
@ eid_max
The last enumerator tracks the number of defined IDs. It must remain the last one.
@ eid_invalid_multiple_scheduling
@ eid_reservation_length_error
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
@ eid_invalid_load_factor
void PrintExtraVersionInfo(const char *category, const char *format,...)
Prints arbitrary extra TBB version information on stderr.
#define PRINT_ERROR_AND_ABORT(exc_name, msg)
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
Copyright © 2005-2020 Intel Corporation. All Rights Reserved.
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
registered trademarks or trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
* Other names and brands may be claimed as the property of others.