View Issue Details

IDProjectCategoryView StatusLast Update
0016846CommunityOCCT:Foundation Classespublic2011-12-01 11:22
ReporterabvAssigned Toabv 
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
OSAll 
Fixed in Version6.2.1 
Summary0016846: [OCCT Forum] Multithreading troubles: reference counter of Standard_Transient
DescriptionAs indicated on OCCT Forum message
http://www.opencascade.org/org/forum/thread_11273, OCCT Handle mechanism is not thread-safe due to the fact that
reference counter is not protected against simultaneous modification by several
threads.

See IFMT 214 for discussion of how this can be fixed
Additional information
and documentation updates
Documentation remark, added by ABV 2007-10-22 15:46:39:

New features:
New static functions IsReentrant() and SetReentrant() are added in Standard
package to query and set flag for reentrant (i.e. thread-safe) mode of
operation of TKernel services (memory manager, handles, exceptions).
Note that by default this mode is Off; it can be activated also by defining
environment variable MMGT_REENTRANT before starting OCCT.
Improvements:
Reference counter in Standard_Transient class (thus all OCCT classes managed by
handles) is protected to be thread-safe. Note that this protection is effective
only on Windows and Linux platforms by the moment, and is active only if
reentrant mode is set (see Standard::IsReentrant()).

Note that this improvement leads to some downgrade of performance of creation
and desctruction of Handle objects (by ~ 2 times when reentrant mode is OFF, ~ 10
times when it is ON), thus it becomes yet more important to avoid creation of
unnecessary Handles in performance-critical parts of the code. For information,
the time of creation and destruction of one Handle measured on P4 3GHz CPU is
around 20 ns in non-reentrant mode and 100 ns in reentrant mode.
Changes:
Some changes have been made in basic OCCT headers:

- Statement "using std;" in Standard_Stream.hxx has been replaced by individual
"using" statements for several types used extensively inside OCCT code. This
should reduce risk of conflicts between OCCT headers and application codes due
to imported STL names. On the other side, some code probably might need to be
corrected to add std:: prefix before STL classes (or equivalent using
statement).

- In Standard_Macro.hxx for WNT plaftform, a number of macros have been defined
(such as WIN32_LEAN_AND_MEAN) aimed to reduce scope of symbols defined by
eventual inclusion of windows.h. This is necessary to prevent interference
between multiple macro definitions made in windows.h (e.g. SendMessage #defined
as SendMessageA) and normal code of OCCT and applications. If some code needs
complete set of symbols defined in windows.h, this code may include windows.h
prior to OCCT headers.
TagsNo tags attached.
Test case number

Attached Files

  • occ16846-abv-v1.tar.gz (17,199 bytes)
  • occ16846-abv-test-v1.tar.gz (1,626 bytes)
  • occ16846perf.xls (23,552 bytes)
  • occ16846-abv-v2.tar.gz (18,330 bytes)
  • occ16846-abv-v3.tar.gz (21,096 bytes)
  • occ16846-abv-v4.tar.gz (170,111 bytes)
  • occ16846-abv-gal-v1.tar.gz (39,244 bytes)
  • occ16846-abv-v5.tar.gz (175,141 bytes)
  • occ16846-abv-v6.tar.gz (198,489 bytes)
  • occ16846-abv-v7.tar.gz (237,406 bytes)
  • occ16846-prod-abv-v1.tar.gz (5,425 bytes)
  • occ16846-prod-abv-v2.tar.gz (8,862 bytes)

Activities

2007-09-05 09:27

 

occ16846-abv-v1.tar.gz (17,199 bytes)

2007-09-05 10:13

 

occ16846-abv-test-v1.tar.gz (1,626 bytes)

2007-09-05 10:13

 

occ16846perf.xls (23,552 bytes)

2007-09-10 11:20

 

occ16846-abv-v2.tar.gz (18,330 bytes)

2007-09-10 12:50

 

occ16846-abv-v3.tar.gz (21,096 bytes)

2007-09-26 11:09

 

occ16846-abv-v4.tar.gz (170,111 bytes)

2007-09-26 11:27

 

occ16846-abv-gal-v1.tar.gz (39,244 bytes)

2007-09-27 18:08

 

occ16846-abv-v5.tar.gz (175,141 bytes)

2007-10-02 13:31

 

occ16846-abv-v6.tar.gz (198,489 bytes)

2007-10-04 14:39

 

occ16846-abv-v7.tar.gz (237,406 bytes)

2007-10-08 15:48

 

occ16846-prod-abv-v1.tar.gz (5,425 bytes)

2007-10-08 17:28

 

occ16846-prod-abv-v2.tar.gz (8,862 bytes)

Issue History

Date Modified Username Field Change
2007-09-05 11:28 abv CC => pdn, szv, agv
2007-09-07 16:51 bugmaster Status closed => assigned
2007-09-07 16:51 bugmaster Resolution suspended => @0@
2007-09-07 16:52 bugmaster Assigned To bugmaster => abv
2007-09-10 13:24 abv Status assigned => resolved
2007-10-09 17:24 bugmaster Status resolved => tested
2007-10-25 18:31 bugmaster Status tested => verified
2009-06-23 17:10 bugmaster Status verified => closed
2009-06-23 17:10 bugmaster Resolution @0@ => fixed
2011-08-02 11:23 bugmaster Category OCCT:FDC => OCCT:Foundation Classes
2011-11-28 10:38 abv Description Updated
2011-11-28 10:38 abv Additional Information Updated
2011-11-28 10:39 abv Description Updated
2011-12-01 11:22 szy Additional Information Updated