Skip to content

MikeGitb/ObjectStore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3f83c02 · Oct 6, 2020

History

31 Commits
Feb 5, 2018
Feb 5, 2018
Oct 6, 2020
Feb 12, 2020
Feb 5, 2018
Feb 3, 2018
Feb 3, 2018
Jun 12, 2019
Feb 3, 2018
Feb 3, 2018
Feb 11, 2020

Repository files navigation

SharedObjectStore

A header only library providing an object store whose objects can be shared among multiple threads

General idea:

  • An object is created in a pre-allocated area and paired with a refcount
  • The user gets a handle which allows modifications of that object, but the handle can't be copied (only moved)
  • Copying the handle (for sharing accross multiple threads) is only possible by turning the handle into a read_only handle - invalidating the original handle
  • Read only handles can be copied across multiple threads and as we know, that no one can modify the object, reading from it is safe
  • For each copy of the read_only handle, the refcount is increased by one
  • Turning a read only handle back into a mutable handle is only allowed if the refcount is 1 (i.e. we are the only one holding a handle to the object)
  • If all handles are destroyed, the object is destroyed, too.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published