cached_pool.bmx 525 B

1234567891011121314151617181920212223242526272829303132333435
  1. SuperStrict
  2. Framework BRL.Standardio
  3. Import BRL.ThreadPool
  4. Import brl.glmax2d
  5. Local pool:TThreadPoolExecutor = TThreadPoolExecutor.newCachedThreadPool(5000)
  6. Graphics 800, 600, 0
  7. Local tick:Int
  8. While Not KeyDown(key_escape)
  9. Cls
  10. tick :+ 1
  11. DrawText "Threads Alive : " + pool.threadsAlive, 50, 50
  12. DrawText "Threads Working : " + pool.threadsWorking, 50, 80
  13. If KeyHit(key_space) Then
  14. pool.execute(New TTask)
  15. End If
  16. Flip
  17. Wend
  18. Type TTask Extends TRunnable
  19. Method run()
  20. Delay 10000
  21. End Method
  22. End Type