-
Notifications
You must be signed in to change notification settings - Fork 774
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
Implement thread-safe creation of proj mutex (fixes #954) #958
Conversation
bfd3bbd
to
9ee9e7a
Compare
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.
Thanks for taking care of this. I haven't got enough insight to comment on the implementation but I am wondering if it is possible to create a simple test so we can avoid the original problem in the future? Or is it one of those multithreading problems that only appears in big and complicated settings?
static pthread_once_t sOnceKey = PTHREAD_ONCE_INIT; | ||
if( pthread_once(&sOnceKey, pj_create_lock) != 0 ) | ||
{ | ||
fprintf(stderr, "pthread_once() failed in pj_acquire_lock().\n"); |
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.
Please use either proj_log_error
or proj_log_debug
, depending on which you think suits the purpose best.
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.
proj_log_error() and proj_log_debug() require a PJ* object which we don't have here
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.
and this error is not supposed to happen in practice. This is mostly so to have a hint of what went wrong in case something (really) bad happen
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.
PJ* object which we don't have here
Right, I totally missed that.
e9c50ee
to
565cced
Compare
src/multistresstest.c should already test this. It is extremly difficult to test that there is no race, by definition of races... |
Yeah, that's what I figured. Just wanted to check if you had an idea to improve the multithreading test. |
No description provided.