Initialization/deinitialization order of UMutex global statics is not defined with VS2017

Description

Due to C++'s "static initialization order fiasco", we should move the UMutex global statics to be function statics instead. This was done as an intermediate change from Andy in PR #522 but later reverted in PR #655.

The proposed change would be like the following on line 66 of locid.cpp:

The code that references these variables will also need to be updated.
There are 23 such occurrences in ICU that should be fixed.

This is only a real concern for Visual Studio versions below 2019, and maybe other compilers that cannot make UMutex constexpr. See umutex.h:

Note that the prebuilt binaries for Windows are built using VS2017.

Assignee

Daniel Ju

Reporter

Daniel Ju

Components

Labels

Reviewer

Jeff Genovy

Priority

medium

Time Needed

Hours

Fix versions

Configure