Request for more functionality for channels
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 45/100
Direzione di ricerca
Read the channel implementation and its tests to find where move operations, capacity, and void channel reads and writes are defined. Start by checking which requested behaviors are supported by the current API and how channel operations handle capacity. Done means agreeing on and implementing the desired set of channel features, with tests covering the selected behaviors.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Moving
Channels are currently having their move constructor and operator explicitly deleted. This prevents a lot of sorts of code decomposition since it is not even possible to make a function to abstract some channels-related stuff. Not to mention that it forces library users into writing some really poor code (for example wrapping channel into unique_ptr to enable moving)
struct smth {
...
boost::cobalt::channel<void> chan;
};
// all below is basically impossible
auto transfer_ownership(smth smth);
boost::cobalt::promise<smth> async_initialization(...);
Occupied capacity requests
Now it is impossible to reason about how much elements is inside the channel. This makes writing a channel-based condition_variable pretty much impossible. There also may be other cases for occupied capacity introspection. This one is just what I have stuck with. Overall, this shall not be a problem to add one extra getter into channel
read/write(N) overload for void channel
Void channel is basically a semaphore. And sometimes it is useful to state that some operations on such semaphore require more parallelism units than others. In such cases something like that has to be written
// for acquiring of N slots
for (size_t i = 0; i < N; ++i) {
co_await chan.read();
}
// for releasing of N slots
for (size_t i = 0; i < N; ++i) {
co_await chan.write();
}
There is also a problem that in both of these examples a deadlock is possible if channel has less slots capacity in it than N. And another smaller problem is that if read/write blocks then another one extra slot (up to N) is asked and is possibly blocked once again making otherwise unnecessary context switches in scheduler.
Both of abovementioned problems are avoidable (except for context switches) if user constructs it's own primitive for semaphore using channel. But semaphore is probably needed often enough in different codebases for library to provide it
Batch-processing for data in non-void channels may also be useful in theory. But I cannot imagine a good example for this and thus will not advocate for it
- Lingua principale
- C++
- Stelle
- 351
- Fork
- 47
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di boostorg/cobalt
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
Tutte le issue di boostorg/cobalt
Issue simili
-
agent:WSL code-review linux pri:medium refactoring
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
kind/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
psi29a/d2decomped#691 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
CachyOS/packageinstaller#144 ·
I maintainer di solito rispondono entro 1 giorno
-
(S1 - Need confirmation)
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
CleverRaven/Cataclysm-DDA#89715 ·
I maintainer di solito rispondono entro 1 giorno