[NAME]
ALL.misc.comparison.tasklet

[TITLE]
Concurrency Tasklet (Go)

[DESCRIPTION]

In Go, lightweight threads or tasklets can be created by starting goroutines: 
     
   1  func Sum( ch chan int ){
   2      sum = 0
   3      for index := 0; index < 100; index++ {
   4          sum += index
   5      }
   6      ch <- sum
   7  }
   8  ch := make(chan int, 1)
   9  
  10  go Sum( ch )  # Start goroutine;
  11  sum = <-ch    # Wait for the result;
     


In Dao, they can be created by using Asynchronous Function Calls: 
     
   1  routine Sum(){
   2      sum = 0
   3      for( index = 0; index < 100; ++index ){
   4          sum += index
   5      }
   6      return sum
   7  }
   8  fut = Sum() !!     # Asynchronous Function Call (returns a future value);
   9  sum = fut.value()  # Wait for the result;
     
There are other ways to create tasklet in Dao, please see dao.concurrent for details.