Ticket #1979 (closed defect: fixed)

Opened 8 months ago

Last modified 8 months ago

CPLSPrintf is not thread safe

Reported by: daniel112b Assigned to: warmerdam
Priority: normal Milestone: 1.4.4
Component: default Version: unspecified
Severity: normal Keywords: threadsafety
Cc: daniel112b@gmail.com

Description

It looks like CPLSPrintf is using thread local storage for it's buffers but it's not. CPL_THREADLOCAL is just defined to be empty.

My problems occur while i'm trying to extract the styling info and i end up with an empty style string when running multiple threads that read data from their own OGRDataSource.

http://lists.maptools.org/pipermail/gdal-dev/2007-November/014787.html

Change History

11/09/07 12:27:15 changed by warmerdam

  • keywords set to threadsafety.
  • status changed from new to assigned.
  • milestone set to 1.4.4.

Problem confirmed. The CPLSPrintf() buffer ring needs to be made thread local using the CPL*TLS services. I will take care of this issue.

11/09/07 14:38:14 changed by warmerdam

  • status changed from assigned to closed.
  • resolution set to fixed.

Fixed in trunk as r12681 as r12683. Ported to 1.4 branch as r12688.

Also applied a big pass through trunk removing use of CPLSPrintf() and replacing it with CPLString based solutions as r12686. Substantial work still to do on this as time permits.