tisan2021 / coroutines Goto Github PK
View Code? Open in Web Editor NEWThis project forked from yabadabu/coroutines
Coroutines in C++. (Currently only on windows using Fibers API)
License: MIT License
This project forked from yabadabu/coroutines
Coroutines in C++. (Currently only on windows using Fibers API)
License: MIT License
This is a C++ wrapper on top of libCouritines - Move TChannel to handle-based resource + TimeOut - A co is: - Running, meaning will run until yields or checks a wait condition - Waiting for events we control - Reading data from a channel, and now there is data in the channel - Writing data to a channel, and now there is space in the channel - Waiting another co to finish - Waiting for time - Sort co's waiting for time events, sorted by waiting time. Each time we tick, dispatch those surpassed by the time. A co could be waiting for data in a channel and waiting for time -> - Waiting for user defined conditions which need to be checked/poll on every tick - Waiting for I/O,Net operations - Allow user to create his own events, which when triggered will wake up - Implications - A channel must known which co's are waiting for data in the channel - A channel must known which co's are waiting for space in the channel - A co must known who is waiting for him. And wake up when dies. - There is a list of co waiting for time events - A co could be waiting for several channels events and a timeout - When a channel get data and there is more than one co waiting for that data choose a random co and give him the data - All this could be generalized to: - There are events - Type and arg - There are event_watchers: pairs_of: event - co - When an event is fired -> chech if there are watchers of this event - awake the associated co - remove events watched by the co - Or we could have: - Event sources: - Examples - Coroutines when leaving - Channels when data becomes available - Channels when data can be stored - Time clock - Members - List of watchers waiting for the events for each event type - Event watchers: The co's - Need to know to which event sources they are subscribed - Need to be able to unsubscribe from all their event sources - If the 'watched event' is created in the stack, we don't need to malloc/free that memory Just be sure the events are unregistered when the thread continues - Add a next/prev link so the events can be anywhere - When a co wants to 'wait' for activity in two channels with a timer... TEventWatch events_to_watch[3] = { { this_handle, EVT_CHANNEL_DATA_CAN_BE_READ, channel1, &data1, next? } , { this_handle, EVT_CHANNEL_DATA_CAN_BE_READ, channel2, &data2, next? } , { this_handle, EVT_TIME, now() + 10 } }; wait( events_to_watch ); - co's are dispatched by several threads, not just one (a la ps4) - Test in unix - Check support for coroutine local storage (or cls())
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.