[Proj] PROJ.4 thread-safety (same player shoot again)

Patrick Mézard pmezard at gmail.com
Fri Feb 25 09:48:08 EST 2005

On Fri, 25 Feb 2005 09:04:45 -0500, Frank Warmerdam
<fwarmerdam at gmail.com> wrote:
> On Fri, 25 Feb 2005 14:39:44 +0100, Patrick Mézard <pmezard at gmail.com> wrote:
> > Hello,
> > Assuming that I only use pj_init, pj_free, pj_fwd, pj_inv,
> > pj_transform and if I move pj_errno into thread local storage, do you
> > think PROJ.4-4.9 is thread-safe (under Win32) ?
> >
> > (Sorry to bother you again but I really have to know that).
> Patrick,
> There are also issues in PROJ 4.4.9 with datum shifting (via
> pj_transform()).  The datum tables are loaded into memory and
> kept in a linked list for re-use.  Changes to this list would need
> to be protected by a lock, or else all the datum loading stuff would
> need to be kept in thread local storage (better to lock).

I don't get it.
Correct me if I am wrong. Datums are listed in pj_datums[]. This array
is read-only. Other datums can be defined when calling pj_init, but
they are added to the projection being defined, not to a global datum
registry. So, as long as projPJ is used in a thread safe manner (one
per thread at least, one for the whole program if they are const once
defined) there is no problem with datum definitions.

Now, another interesting question is : are projPJ structures modified
by pj_transform/pj_fwd/pj_inv ? It seems that libproj4 does not change
them. Does PROJ.4 leave them unmodified too ?

Patrick Mézard

More information about the Proj mailing list