Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wip cxx11concurrency #5931

Merged
merged 3 commits into from Feb 8, 2016
Merged

Wip cxx11concurrency #5931

merged 3 commits into from Feb 8, 2016

Conversation

adamemerson
Copy link
Contributor

This pull request includes implementations of the SharedMutex and SharedTimedMutex concepts (with debugging implementations), debugging implementations of the Mutex concept, an implementation of shared_lock, and a shunique_lock implementation managing shared and unique lock state.

We also modify OSDC to use C++ style locking as a demonstration.

(And replace get_osdmap_read/put_osdmap_read with with_osdmap, which is a bit more lock-safe.)

cbodley referenced this pull request in cbodley/ceph Jan 12, 2016
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
Locker class tracking shared/unique/unlocked state of SharedMutex
concept.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
The only externally visible change is that Objecter::get_osdmap_read
and Objedcter::put_osdmap_read have been removed in favor of
Objecter::with_osdmap.

It can be used like:

objecter->with_osdmap([&](const OSDMap& o) { o.do_stuff(); };
int x = objecter->with_osdmap([&](const OSDMap& o) {
    return get_thing(id); });
objecter->with_osdmap(std::mem_fn(&OSDMap::do_stuff));
int x = objecter->with_osdmap(std::mem_fn(&OSDMap::get_thing),
                              id);

The choice between the style of the first two examples or the second two
is arbitrary and depends on what you prefer.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
liewegas added a commit that referenced this pull request Feb 8, 2016
librados: move to c++11 concurrency types

Reviewed-by: Matt Benjamin <mbenjami@redhat.com>
Reviewed-by: Casey Bodley <cbodley@redhat.com>
@liewegas liewegas merged commit 6a8cafe into master Feb 8, 2016
@liewegas liewegas deleted the wip-cxx11concurrency branch February 8, 2016 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants