MantisBT - Community
View Issue Details
0016846Community[OCCT] OCCT:Foundation Classespublic2007-09-05 11:062011-12-01 11:22
abv 
abv 
normaltrivial 
closedfixed 
All
 
[OCCT] 6.2.1 
0016846: [OCCT Forum] Multithreading troubles: reference counter of Standard_Transient
As 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
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.
No tags attached.
gz occ16846-abv-v1.tar.gz (17,199) 2007-09-05 09:27
https://tracker.dev.opencascade.org/
gz occ16846-abv-test-v1.tar.gz (1,626) 2007-09-05 10:13
https://tracker.dev.opencascade.org/
xls occ16846perf.xls (23,552) 2007-09-05 10:13
https://tracker.dev.opencascade.org/
gz occ16846-abv-v2.tar.gz (18,330) 2007-09-10 11:20
https://tracker.dev.opencascade.org/
gz occ16846-abv-v3.tar.gz (21,096) 2007-09-10 12:50
https://tracker.dev.opencascade.org/
gz occ16846-abv-v4.tar.gz (170,111) 2007-09-26 11:09
https://tracker.dev.opencascade.org/
gz occ16846-abv-gal-v1.tar.gz (39,244) 2007-09-26 11:27
https://tracker.dev.opencascade.org/
gz occ16846-abv-v5.tar.gz (175,141) 2007-09-27 18:08
https://tracker.dev.opencascade.org/
gz occ16846-abv-v6.tar.gz (198,489) 2007-10-02 13:31
https://tracker.dev.opencascade.org/
gz occ16846-abv-v7.tar.gz (237,406) 2007-10-04 14:39
https://tracker.dev.opencascade.org/
gz occ16846-prod-abv-v1.tar.gz (5,425) 2007-10-08 15:48
https://tracker.dev.opencascade.org/
gz occ16846-prod-abv-v2.tar.gz (8,862) 2007-10-08 17:28
https://tracker.dev.opencascade.org/
Issue History
2007-09-05 11:28abvCC => pdn, szv, agv
2007-09-07 16:51bugmasterStatusclosed => assigned
2007-09-07 16:51bugmasterResolutionsuspended => @0@
2007-09-07 16:52bugmasterAssigned Tobugmaster => abv
2007-09-10 13:24abvStatusassigned => resolved
2007-10-09 17:24bugmasterStatusresolved => tested
2007-10-25 18:31bugmasterStatustested => verified
2009-06-23 17:10bugmasterStatusverified => closed
2009-06-23 17:10bugmasterResolution@0@ => fixed
2011-08-02 11:23bugmasterCategoryOCCT:FDC => OCCT:Foundation Classes
2011-11-28 10:38abvDescription Updatedbug_revision_view_page.php?rev_id=1118#r1118
2011-11-28 10:38abvAdditional Information Updatedbug_revision_view_page.php?rev_id=1120#r1120
2011-11-28 10:39abvDescription Updatedbug_revision_view_page.php?rev_id=1121#r1121
2011-12-01 11:22szyAdditional Information Updatedbug_revision_view_page.php?rev_id=1179#r1179

There are no notes attached to this issue.