Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ TheIDE and Library: Releases and ChangeLogs » init_ and GLOBAL_ changes
init_ and GLOBAL_ changes [message #9097] Tue, 17 April 2007 09:44
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
In process of refining MT issues, I had to deal with "GLOBAL_" variables concept and "Registration" issues.

The problem there is that in order to achieve good performance of MT application, it is critical to reduce mixing reads and writes.

In case of various registration facilities, like registration of Value types or Image encoding formats, it looks like ideal solution to allow registration only before the first Thread starts (usually, it is done in INITBLOCK anyway) - this way, accesses in MT will be read only and no locking is required.

In order to make this transparent, I have introduced new "keyword" init_ to mark functions/methods that are allowed to be called in this initialization ST phase. Function AssertST can be used to check inside registration function to check this in debug mode too.

Similar issue are varous singleton classes, like those defined in Convert.h. Originally, they were initialized using double-checked pattern, but new GLOBAL_*_INIT macros are able to initialize them in st-init phase too, so again no further checking/locking is required.
Previous Topic: New Core...
Next Topic: RichEdit now support overwrite mode (Insert key...)
Goto Forum:
  


Current Time: Wed May 22 01:39:57 CEST 2024

Total time taken to generate the page: 0.01353 seconds