concurrent-ruby
concurrent-ruby copied to clipboard
should the thread_local_var_accessor gem be included within the concurrent-ruby gem?
I've written a little gem that makes concurrent-ruby's thread-local variables easy to use, in the same manner of attr_reader, attr_writer, attr_accessor
: it is called: thread_local_var_accessors
See:
- https://github.com/aks/thread_local_var_accessors
- https://rubygems.org/gems/thread_local_var_accessors
Eg:
tlv_reader :var1
tlv_writer :var2
tlv_accessor: :var3
I've been using it in my company software for some time now. It is an easy way to encourage developers to improve the thread-safetyness of their code, especially code that runs in a multi-threaded environment (eg: sidekiq tasks).
I'm happy to continue maintaining it separately, but I'm also happy to contribute it to the core concurrent-ruby gem, if that's appropriate. In the latter case, since we are already using concurrent-ruby elsewhere, for other reasons, it would mean one gem less to track for us. 😄