Re: [gdal-dev] libecwj2 with multiple readers

2013-01-16 Thread Mateusz Loskot
On 16 January 2013 10:13, Even Rouault  wrote:
> Hi Mateusz,
>
> Looking at NCJP2FileView.cpp, I can see that most accesses to sm_Views are
> protected with CNCSJPCGlobalLock _Lock;
>
> Perhaps it should also be added to CNCSJP2FileView::Shutdown() which seems the
> only place in that file not protected by the lock.

Hi Even,

Lock is one side of the problem.
The second one is non-deterministic nature static initialization and
static deinitialisation issue. In this case, the latter.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] libecwj2 with multiple readers

2013-01-16 Thread Even Rouault
Hi Mateusz,

Looking at NCJP2FileView.cpp, I can see that most accesses to sm_Views are
protected with CNCSJPCGlobalLock _Lock;

Perhaps it should also be added to CNCSJP2FileView::Shutdown() which seems the
only place in that file not protected by the lock.

Best regards,

Even
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


[gdal-dev] libecwj2 with multiple readers

2013-01-15 Thread Mateusz Loskot
Hi,

Without getting into details, I wonder, has anyone ever used GDAL with
libecwj2 support to access ECW dataset(s) from multiple readers?

Apparently, libecwj2 manages some internal static environment which
can not be safely shared, unless all accesses to libecwj2 are serialised.
For example, in CNCSJP2FileViewVector class there is

static CNCSJP2FileViewVector sm_Views;

and the way it is used, may lead to subtle problems
and destruction fiasco related to multiple threads
managed by this static object.
Possible simple solution is to replace this static object
with one allocated from dynamic storage.
But, it seems it does not solve all possible. problems
and may fail if libecwj2 is accessed (through GDAL)
from multiple threads.
One leak of problem is crash during shutdown stages in libecwj2.

Does anyone know any piece of documentation where relevant
limitations and assumptions of libecwj2 are described,
either internal docs in GDAL or external resources.
Any related brainstorming would be greatly appreciated.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev