Intel® C++ Compiler 16.0 User and Reference Guide
void __cilkrts_end_cilk(void);
This function shuts down and deallocates all Intel® Cilk™ Plus states. The runtime system will abort the application if Intel® Cilk™ Plus is still in use by this thread. Otherwise, the runtime system will wait for all other threads using Intel® Cilk™ Plus to exit.
Use of __cilkrts_end_cilk() will allow you to change the number of workers. With no spawning function executing, call __cilkrts_end_cilk(), then call __cilkrts_set_param() to set the desired number of workers. The runtime system will automatically restart when needed to execute a cilk_spawn or cilk_for statement, or when you call __cilkrts_init().