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
Messages: 14039 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.
|
|
|
Goto Forum:
Current Time: Sat Sep 21 03:07:13 CEST 2024
Total time taken to generate the page: 0.04746 seconds
|