Coroutines are computer program components that generalize subroutines for nonpreemptive multitasking, by allowing multiple entry points for suspending and resuming execution at certain locations. Coroutines are well-suited for implementing more familiar program components such as cooperative tasks, exceptions, event loop, iterators, infinite lists and pipes.
According to Donald Knuth, the term coroutine was coined by Melvin Conway in 1958, after he applied it to construction of an assembly program. The first published explanation of the coroutine appeared later, in 1963.
When subroutines are invoked, execution begins at the start, and once a subroutine exits, it is finished; an instance of a subroutine only returns once, and does not hold state between invocations. By contrast, coroutines can exit by calling other coroutines, which may later return to the point where they were invoked in the original coroutine; from the coroutine's point of view, it is not exiting but calling another coroutine. Thus, a coroutine instance holds state, and varies between invocations; there can be multiple instances of a given coroutine at once. The difference between calling another coroutine by means of "yielding" to it and simply calling another routine (which then, also, would return to the original point), is that the latter is entered in the same continuous manner as the former. The relation between two coroutines which yield to each other is not that of caller-callee, but instead symmetric.
Another day try to stand up straight;
keep the world from draggin' me,
down’; fight the flames that feed
the fire, but my mind keeps spinnin'
around. Holding on to what You
said, cuz I know Your words are
true; only way to win this fight is
to keep my eyes on, You
CHORUS
Fire and Love, the two extremes
that we live between. Fire and
Love, there’s more to life than the
eye can see.
Feelin' down, well I've been there
too; I know just how you, feel. A
winning hand from every side, it's
hard to tell what's real. Caught
between the two extremes, Feel
the pull from side to side. Trying
to run the easy road; just enough
to get you by.
BRIDGE:
Oh Lord, I know You've got the
answers; Oh Lord, I know You are
the Way. Oh Lord, I know You
are the Answer, Oh Lord, I need
You, everyday.
CHORUS
BRIDGE
CHORUS