concurrent-ruby icon indicating copy to clipboard operation
concurrent-ruby copied to clipboard

should the thread_local_var_accessor gem be included within the concurrent-ruby gem?

Open aks opened this issue 7 months ago • 3 comments

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. 😄

aks avatar Jul 25 '24 06:07 aks