Humanizer icon indicating copy to clipboard operation
Humanizer copied to clipboard

Humanizer inflection vocabulary threading problem

Open thejjmiller opened this issue 11 years ago • 2 comments

There is a problem with in the Vocabularies class. If you try to read the default vocabulary on two separate threads you can get a index out of range exception because there is no locking around the default variables. There are 3 possible fixes to this.

  1. Put the default building into a static constructor so that it is only ever called on one thread.
  2. Put locking around the default variable so that two threads cant manipulate the same vocabulary.
  3. Change the BuildDefault method so that adds values to a local variable and then at the end of the method set the _default variable.

thejjmiller avatar Jun 30 '15 15:06 thejjmiller

Thanks for reporting this @thejjmiller. Another alternative I really like is to use Lazy.

MehdiK avatar Jul 01 '15 09:07 MehdiK

Resolved in #439

MehdiK avatar Jul 03 '15 21:07 MehdiK