next up previous contents
Next: First-Class Continuations Up: Coordinating Concurrency Previous: Token-Passing Continuations


Join Blocks

The previous sub-section has illustrated how token-passing continuations work in message passing. This sub-section introduces join blocks which can specify a barrier for parallel processing activities and join their results in a subsequent message. A join continuation has a scope (or block) starting with "join{ " and ending with "}". Every message inside the block must be executed, and then the continuation message, following @, can be sent. For instance, the following example prints either "Hello World SALSA" or "WorldHello SALSA":
 
join {
  standardOutput <- print("Hello ");  
  standardOutput <- print("World");
} @  standardOutput <- println(" SALSA");
 
   
Using the return token of the join block will be explained in Chapter 5.



Wei-Jen Wang
2007-11-28