Comments (2)
Yes, we need more simple examples, and a simple scheduler
example would be very enlightening.
You're not far off here. One mistake you're making is that you're calling the receiver methods more than once. Exactly one receiver method (set_value
, set_error
, set_done
) must be called exactly once. (set_done
should only be called when the work has been cancelled, which isn't the case here.)
Better would be to use an algorithm repeat_effect_with_blocking_delay
to repeatedly connect
the sender returned from schedule
multiple times with a sleep between them. You could implement it in terms of repeat_effect_until
. (To get an idea, take a look at how repeat_effect
is implemented in terms of repeat_effect_until
and a forever
predicate.)
And if you really want a scheduler with this behavior baked in, you can have your schedule()
function return a result of calling repeat_effect_with_blocking_delay
.
from libunifex.
Thanks for your response. I am looking into the repeat_effect_until
code. In the meantime I had a look at the io_epoll
code. What I can gather from the epoll code is that the data is read only when async_read_some
is called. This seems to be pulling data from the read_sender
, rather that read_sender
pushing data (as would happen in normal socket programming / callbacks). Is the generalized concept of unifex pull rather than push? The one receiver method rule you mentioned would also make more sense in the pull context. Or is there a push paradigm also?
from libunifex.
Related Issues (20)
- flat combining for async_mutex
- Cleanup `io_uring_context`
- at_coroutine_exit can probably break scheduler affinity
- Adopt stdexec's concept of environments and queries
- Lifetime issues in `type_erased_stream`
- Look into using clang-tidy HOT 8
- MSVC warning C4459: declaration of 'cleanup' hides global declaration HOT 2
- blocking_kind customization does not compile HOT 1
- let_value decay-copies its final result HOT 4
- Using any_object with any_scheduler
- Fix errors when syncing master back to third-party HOT 1
- How to distinguish between cancellation from stop_when and ouside?
- Improve and rename `type_erased_stream` -> `any_stream_of`
- build libunifex failed with g++ 13.1.0
- `task` resumes after being cancelled causing UB HOT 6
- request_stop() return value is invalid
- (Is there already) support for async stream HOT 7
- How to properly use gtest dependency for building libunifex?
- Compile error with MSVC in default settings HOT 3
- Compile failed In Default Setting HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libunifex.