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

LCC projection not thread safe #41

Closed
proj4-bot opened this issue May 22, 2015 · 3 comments
Closed

LCC projection not thread safe #41

proj4-bot opened this issue May 22, 2015 · 3 comments

Comments

@proj4-bot
Copy link

Reported by artwisz on 22 May 2009 11:44 UTC
The lcc projection is currently not thread safe. The rho parameter should be removed from PJ and declared on the stack in the projection functions.
File: PJ_lcc.c

Migrated-From: https://trac.osgeo.org/proj/ticket/41

@proj4-bot
Copy link
Author

Comment by warmerdam on 22 May 2009 14:15 UTC
Unfortunately, I don't understand some of the entry points in PJ_lcc, and P->rho seems to be used in several of the functions. It is not at all clear it is a simple local that happens to have been put into the structure.

Also, this only puts full thread safety at risk - that is when multiple pj_fwd/pj_inv calls are being made on the same PJ object. With regard to thread safety I have traditionally been primarily concerned about safety when different threads are using distinct PJ objects which is not put at risk in this case.

I'm going to leave this open as a defect but I'm not expecting to take any immediate action.

@proj4-bot
Copy link
Author

Comment by artwisz on 22 May 2009 15:02 UTC
I have removed the rho from the PJ structure, made rho a local variable and both forward and inverse transforms seem to be working. If you take a look at all control paths in the code, rho is always calculated before being used, so it need not be a structure member. Moreover, the LCC ENTRY (init) does not initialize rho at all, only rho0.
Generally, adding a const to the *pj parameter in the forward/inverse declarations is a good way to fish out all code where the structure is modified, which in this case is not thread safe. I am only using the LCC, so I don't know much about other projections.

@proj4-bot
Copy link
Author

Comment by warmerdam on 24 Sep 2009 01:50 UTC
I concur with your analysis. I have removed rho from the structure in trunk (84d22b2e (SVN rev1629)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant