Date Added: Oct 2012
Threads and events are two common abstractions for writing concurrent programs. Because threads are often more convenient, but events more efficient, it is natural to want to translate the former into the latter. However, whereas there are many different event-driven styles, existing translators often apply ad-hoc rules which do not reflect this diversity. The authors analyse various control flow and data flow encodings in real-world event-driven code, and they observe that it is possible to generate any of these styles automatically from threaded code, by applying certain carefully chosen classical program transformations. In particular, they implement two of these transformations, lambda lifting and environments, in CPC, an extension of the C language for writing concurrent systems.