Sha256: 3e024a19a8879931f82efb23484c442e1178d6c859b2febd00d626e8f3ebd2a4
Contents?: true
Size: 959 Bytes
Versions: 2
Compression:
Stored size: 959 Bytes
Contents
Thread and Fiber specific global state ====================================== Know DataMapper's repository contexts? Need request-specific global state in an evented webserver? Wanna do complex AOP but care about concurrency? Kontext comes to your rescue. It provides you with nestable per-thread, per-fiber context stacks. ```ruby require "kontext" context = Kontext.new context.with "foo" do p context.last # => "foo" context.with "bar" do p context.stack # => ["foo", "bar"] end Fiber.new do p context.last # => nil context.with "different context!" do p context.last # => "different context!" Thread.start do context.with "again different" do p context.stack # => ["again different"] end end sleep 0.1 end end.resume end ``` To do ----- * Fix memory leak in `#store` * Make new threads and fibers inherit a copy of the previous context stack
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kontext-0.1.1 | README.md |
kontext-0.1.0 | README.md |