-
Notifications
You must be signed in to change notification settings - Fork 347
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
Extend error and notice notification with threadsafe variants #26
Conversation
Rename initGEOS_r_v2 to GEOS_init_r Add GEOS_finish_r Rename GEOSContext_setNoticeHandler_r_v2 to GEOSContext_setNoticeMessageHandler_r Rename GEOSContext_setErrorHandler_r_v2 to GEOSContext_setErrorMessageHandler_r
|
Further simplification: why would GEOSMessageHandler_r need to take a pointer to GEOSContext instance ? |
|
That does make more sense. I removed it. |
|
A quick local patch that didn't want to loose: |
|
So last thing I'd like to think more about is the naming of functions to set the new handlers. I don't like how it looks like the old and the new both take a"GEOSMessageHandler" (one with an "_r" suffix) |
|
Yep it's a bit confusing this way. I had the feeling all the good names were already taken. The MessageHandler_r is the actual _r variant, but GEOSContext_setNoticeHandler_r already exists. I initially had GEOSContext_setNoticeMessageHandler_r_v2, but I found that kind of ugly. Perhaps a name that refers to the userdata parameter. I don't have any intuitive sounding, self explanatory suggestions I'm afraid. |
|
@rouault could you take a look at this ? I guess these are the signature I was mentioning on the mailing list, for lack of _r suffix. |
|
@srtk revisiting this based on a question on the spatialite mailing list. What was the naming issue we got stuck on exactly? I tried to figure it out based on the past discussion, but I can't seem to pinpoint what the exact issue was. |
|
It was the confusion between GEOSContext_setNoticeHandler_r and GEOSContext_setNoticeMessageHandler_r signatures (and the one for Error). |
|
Right, thanks for refreshing my memory.
If you let me know which one has your preference I'll make the necessary changes. Either way a deprecation comment on the older version pointing to the new one is indeed a good idea. |
|
I surrender to GEOSContext_setNoticeMessageHandler_r (current naming).
The deprecation warning must be in place _and_ it must be ensured that
old clients do not break.
|
|
@robe2 I think this would be better included in next release (3.5.0) |
|
I found an already existing trac ticket: https://trac.osgeo.org/geos/ticket/663 |
|
@strk I'm a little strapped for time at the moment. What's the target release date for 3.5.0? In other words, by when do you need this PR polished up and ready to merge? |
|
I've rather extensively tested this patch on SpatiaLite, and I can confirm that it works nicely and doesn't break any back compatibility. more important than all, it definitely fixes all thread-safety issues. anyway during my tests (heavily based on Valgrind) I discovered a rather trivial error (uninitialized variables) causing crash, the following patch effectively fixes the problem. |
|
@pepijnve please also rebase to trunk after accepting @spatialite contrib. |
|
@spatialite there's no "freeNoticeData" nor "freeErrorData" in the code I'm reading ? |
|
So this was merged in r4060 and @spatialite concerns were addressed in r4061, those two should be shortly available in the git mirror. |
Mark missing test, add tests for tesselate and fix some comments, MinGW build
Extends the C wrapper interface with a means to associate user data with the notification handlers. This enables threadsafe handling of error and notice messages on the consumer side.