#define __TBB_VERSION_STRINGS(N) \
#N": BUILD_HOST imbeu025 (x86_64)" ENDL \
#N": BUILD_OS Ubuntu 18.04.2 LTS" ENDL \
#N": BUILD_KERNEL Linux 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019" ENDL \
#N": BUILD_GCC g++ (GCC) 7.4.0" ENDL \
#N": BUILD_LIBC 2.27" ENDL \
#N": BUILD_LD " ENDL \
#N": BUILD_TARGET intel64 on cc7.4.0_libc2.27_kernel4.15.0" ENDL \
I want to use tbb::task::suspend/resume if I'm inside a TBB task and a regular semaphore otherwise. How can I check if the current function is run from inside a TBB task? Is the condition "tbb::task::self().state() == tbb::task::executing" good enough?
According to the documentation it should work -- have you tried this API? Any problems? Can you describe the overall problem that you work on? Just in case, here is a reference to the page that describes how TBB tasking works:
At the end of the article -- the short description of Fibonacchi example illustrating the reference counting mechanism
specifically, using set_ref_count API which also could be used to see if the reference count is zero which would indicate that task is not longer running.