Intel® C++ Compiler 19.0 Developer Guide and Reference
Intel® Cilk™ Plus is a deprecated feature. Use OpenMP* or Intel® Threading Building Blocks instead. For more information see Migrate Your Application to use OpenMP* or Intel® TBB Instead of Intel® Cilk™ Plus.
int __cilkrts_get_worker_number (void);
The function __cilkrts_get_worker_number returns a small integer indicating the Intel® Cilk™ Plus worker on which the function is executing. The return value is in the range 0 to "__cilkrts_get_nworkers()-1. You can simulate “worker-local storage” by creating an array of size __cilkrts_get_nworkers(), with each element indexed by a worker ID. If more than one user-created thread calls __cilkrts_get_worker_number, they may get identical results (since worker IDs are not unique across user threads). If called in serialized code, __cilkrts_get_worker_number returns zero.