BHConfig 线程安全问题
Opened this issue · 4 comments
raomengyun commented
用 BHConfig 做一些项目公共配置数据的存储,但是发现其不是线程安全的😂,外部去约束 BHConfig 的线程安全做起来相当麻烦,有什么好的方案可以解决么?
codesourse commented
codesourse commented
config会出现线程安全问题,多线程下同时操作这个字典,那不是呵呵
codesourse commented
Multithreaded is not safe.
You can refer to
https://github.com/codesourse/WERouter
MemoryReload commented
@codesourse This is my raw and dump idea: Make a wrapper class, and use composite pattern to wrap BHConfig
class inside it. Then just make the wrapper class Multithreaded safe. Access the wrapper class instead of BHConfig
class. This maybe the balance of not changing BHConfig
class itself and making it Multithreaded safe.