diff options
| author | Austin Hellyer <[email protected]> | 2016-11-22 21:20:46 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-22 21:20:46 -0800 |
| commit | 41820989b48fe803867e19cadde557ea090f99bd (patch) | |
| tree | 601480f55c0358ae0963257307cbd2019423dec0 /examples/06_command_framework/src | |
| parent | Rename the State to Cache (diff) | |
| download | serenity-41820989b48fe803867e19cadde557ea090f99bd.tar.xz serenity-41820989b48fe803867e19cadde557ea090f99bd.zip | |
Change the CACHE to be an RwLock
The global Cache used to be an Arc<Mutex>, however the issue is that it
could only be opened for reading or writing once at a time.
With an RwLock, multiple readers can access the Cache at once, while
only one Writer may at once. This will allow users to be able to have
multiple Readers open at once, which should ease some of the pains with
working with the Cache.
Upgrade path:
Modify all uses of the CACHE from:
`CACHE.lock().unwrap()`
to
`CACHE.read().unwrap()` if reading from the Cache (most use cases), or
`CACHE.write().unwrap()` to write to it.
Diffstat (limited to 'examples/06_command_framework/src')
0 files changed, 0 insertions, 0 deletions