From Bulky Stork, 9 Years ago, written in Plain Text.
This paste is a reply to Rust's threads are non-lightweight from Chocolate Penguin - view diff
Embed
  1. this is thread number 145342
  2. this is thread number 145413
  3. this is thread number 145512
  4. this is thread number 145343
  5. this is thread number 145414
  6. this is thread number 145513
  7.  
  8. ...
  9.  
  10. no errors. runs stable, consumes all cores, no feeling of overloading the system.
  11.  
  12.  
  13. code:
  14.  
  15. package main
  16.  
  17. import "fmt"
  18.  
  19. func main() {
  20.         const nthreads = 1 * 1000 * 1000
  21.  
  22.         for i := 0; i < nthreads; i++ {
  23.                 go func(i int) {
  24.                         fmt.Printf("this is thread number %v\n", i
  25.                 }(i)
  26.         }
  27. }
  28.  
  29. Eat this, Rust!
  30.  
  31. dict.cc:
  32. rust: Rost {m}