-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-127081: add critical sections to dbm
objects
#132749
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
Conversation
The dbm_* functions are not thread-safe, naturally. Add critical sections to protect their use.
dbm
objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, it's easier to add lock_held
variations of functions instead of adding inline critical sections with goto
. For example:
static int
dbm_something_lock_held(PyObject *self)
{
/* ... */
}
static int
dbm_something(PyObject *self)
{
int result;
Py_BEGIN_CRITICAL_SECTION(self);
result = dbm_something_lock_held(self);
Py_END_CRITICAL_SECTION();
return result;
}
Would you mind switching over to that pattern here?
For sure, that would be much more robust, thanks! |
…ction instead of using gotos everywhere.
Sorry for the delay, I will review during the PyCon sprint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well
Oh it's not relatede to dbms. |
The dbm_* functions are not thread-safe, naturally. Add critical sections to protect their use.