/examples/thread_safety.fy

http://github.com/bakkdoor/redis.fy · Unknown · 14 lines · 11 code · 3 blank · 0 comment · 0 complexity · 7a10396672a0616aad6e10a1071402b3 MD5 · raw file

  1. require: "redis"
  2. r = Redis Client new
  3. threads = []
  4. 10 times: |i| {
  5. t = Thread new: {
  6. r set: ("foo", "test: #{i}")
  7. r get: "foo" . println
  8. }
  9. threads << t
  10. }
  11. threads each: 'join