Closed slemiere closed 11 years ago
Actually, global_context
is stored as an atomic object, so I'm pretty sure it should be thread safe. My initial impression is that an add_global_context
would be useful, however, I don't think we need the lock you have here. Look in set_global_context
for how the atomic object is used.
Like the idea though.
It is indeed a lot better using the #update method of Atomic, I have updated my pull request accordingly. Let me know what you think.
Hello,
I needed for my use case to add dynamically data to the global context so I did something like this:
But it wasn't thread safe and I felt like it could be a pretty common use case so I added the functionality directly into Scrolls with the methods add_global_context, let me know if you think it could be useful and if I should change it.
Thanks !