- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
A coroutine is a function that can suspend execution to be resumed later. Coroutines are stackless: they suspend execution by returning to the caller and the data that is required to resume execution is stored separately from the stack. This allows for sequential code that executes asynchronously (e.g. to handle non-blocking I/O without explicit callbacks), and also supports algorithms on lazy-computed infinite sequences and other uses.
----------------------------------------------------
Any chance we will see coroutines in Fortran
Link kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
You can (somewhat) accomplish this with DO WHILE(.not.done) and select case with a state variable where the Done flag and state variable are SAVE.
In a design similar to OpenMP, you would have a master procedure containing the DO WHILE loop and cooperative select case proceture(s) that progress step-by-step.
An alternative method, would be to construct a ring buffer of procedure pointers where the "master" procedure is a simple loop that calls the next procedure pointer in the ring buffer.
The first method would permit you to split a single procedure into multiple parts, whereas the second method requires each fragment to be its own procedure. (collectively the fragments of a "collective"-procedure would use the same module for save states/common variables of the "collective"-procedure.
Jim Dempsey
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
The topic has been raised among the Fortran committee - it did not get a warm reception. Fortran already supports asynchronous I/O.
Fortran has two parallel models, coarrays and DO CONCURRENT. There are existing mechanisms in the language to handle most of what coroutines do.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
https://ecochiccayman.files.wordpress.com/2015/02/o-polar-bear-family-facebook.jpg
You mean something like this look

- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite