Killing spawned functions

Killing spawned functions

Is it possible for a parent function to kill or cancel all its spawned functions?

2 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

This is speculative computing. Cilk++ doesn't have builtin support for speculation because it is non-deterministic. I.e., it makes it difficult to reason about the correctness of code. Thus, Cilkscreen would not necessarily report races when they exist, and Cilkview's output would be irrelevant.

You can, however, implement speculation, yourself, if you don't mind the above limitations. E.g.,

void bar (volatile int *abort_parallelism) {
while (!*abort_parallelism) {
if (do_work() == meets_some_aborting_condition) *abort_parallelism = 1;

void foo () {
volatile int abort_parallelism = 0;
cilk_spawn bar(&abort_parallelism);

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi