From 4cd46c1664472437f701377fe1851db42ed063cf Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 29 Apr 2015 11:24:37 -0400 Subject: [PATCH] add header --- topics/_coroutines_and_aborts.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/topics/_coroutines_and_aborts.mdwn b/topics/_coroutines_and_aborts.mdwn index d7c8b03e..389e7d5e 100644 --- a/topics/_coroutines_and_aborts.mdwn +++ b/topics/_coroutines_and_aborts.mdwn @@ -1,5 +1,7 @@ [[!toc]] +## Coroutines ## + Recall [[the recent homework assignment|/exercises/assignment12]] where you solved the same-fringe problem with a `make_fringe_enumerator` function, or in the Scheme version using streams instead of zippers, with a `lazy-flatten` function. The technique illustrated in those solutions is a powerful and important one. It's an example of what's sometimes called **cooperative threading**. A "thread" is a subprogram that the main computation spawns off. Threads are called "cooperative" when the code of the main computation and the thread fixes when control passes back and forth between them. (When the code doesn't control this---for example, it's determined by the operating system or the hardware in ways that the programmer can't predict---that's called "preemptive threading.") Cooperative threads are also sometimes called *coroutines* or *generators*. -- 2.11.0