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

mgr: safety checks on pyThreadState usage #18093

Merged
merged 3 commits into from Oct 16, 2017
Merged

Conversation

jcsp
Copy link
Contributor

@jcsp jcsp commented Oct 3, 2017

No description provided.

@@ -46,8 +47,8 @@ class MgrPyModule
private:
const std::string module_name;
PyObject *pClassInstance;
PyThreadState *pMainThreadState;
PyThreadState *pMyThreadState = nullptr;
SafeThreadState pMainThreadState;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, they are not pointers anymore. also, i think we might want to stick with the naming convention used by boost, i.e. not_camel_case instead of the camelCase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the moment I would like to keep the name the same to make merging with my other branches easier

John Spray added 3 commits October 16, 2017 07:06
Even at 20, it's pretty heavy to be logging
every lock acquire/release.

Signed-off-by: John Spray <john.spray@redhat.com>
The inclusion of Python.h in the .h was awkward
for other files including Gil.h.

Signed-off-by: John Spray <john.spray@redhat.com>
Previously relied on the caller of Gil() to
pass new_thread=true if they would be
calling from a different thread.

Enforce this with an assertion, by wrapping
PyThreadState in a SafeThreadState class
that remembers which POSIX thread
it's meant to be used in.

Signed-off-by: John Spray <john.spray@redhat.com>
@jcsp jcsp merged commit c21765a into ceph:master Oct 16, 2017
@jcsp jcsp deleted the wip-mgr-gil-safety branch October 16, 2017 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants