{"p":"","h":{"iv":"ROXSYW+cfvEbFHu5","at":"ocxplSQjdRC3tXEtB/9/wg=="}}

Thread safety tip: do not modify the configuration of a library via a singleton at runtime.

Example: MyCoolLib.config.timeout = 30;

This is almost always going to lead to a thread safety issue, most libraries are not design to do this on a per-thread basis.

3
Share
Share on Mastodon
Share on Twitter
Share on Facebook
Share on Linkedin
Dave Copeland :ruby:

@nateberkopec that should be safe in an initializer though, right?

1
1y
Peter Solnica

@nateberkopec or even better: do not expose mutable singletons 🙂

0
1y
ingemar

@nateberkopec If that is done once, at app initialization, it can't be a problem, can it?

0
1y
Replies