Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Clarifying the exception specification for bulk callback functions

Aperta
#2,129 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
cpp

Direzione di ricerca

Leggi include/stdexec/__detail/__parallel_scheduler.hpp alle righe 390-419 e confronta la gestione delle callback del parallel scheduler con l'implementazione predefinita di bulk. Usa l'esempio sync_wait/bulk fornito per stabilire se std::runtime_error dovrebbe raggiungere il set_error del receiver e il catch circostante; il lavoro è concluso quando il contratto delle eccezioni per le implementazioni personalizzate di bulk è deciso e verificato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Do we really allow the bulk callback function to throw an exception? That is, when the bulk callback throws an exception, will that exception be propagated through the receiver's set_error(std::exception_ptr)?
Consider:
Given a scheduler sch, what should be the behavior of the following code?

try {
    stdexec::sync_wait(stdexec::schedule(sch) | stdexec::bulk(std::execution::par, 1uz, [](std::size_t){
        throw std::runtime_error{"xxx"}; 
    }));
}
catch (const std::runtime_error& e) { 
    ...
}

Can the try-catch here catch this std::runtime_error?
For the default implementation of bulk, the answer is yes, it can be caught. But for some customized bulk implementations, it may be different. For example, if sch here is a stdexec::parallel_scheduler, the program will terminate, see https://github.com/NVIDIA/stdexec/blob/e8c349f3f3425b9341306bc56615fc5279a15cf4/include/stdexec/__detail/__parallel_scheduler.hpp#L390-L419
which does not handle the case where the call to __state->__fun_ throws an exception. However, fixing this seems a bit tricky, or should we reconsider the exception specification of bulk_item_receiver_proxy::execute?

Lingua principale
C++
Stelle
2.4k
Fork
270
Merge medio
2g 16h
PR unite (30g)
43

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NVIDIA/stdexec

Tutte le issue di NVIDIA/stdexec

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.