[GNC-dev] gnucash maint: Multiple changes pushed

Geert Janssens geert.gnucash at kobaltwit.be
Wed Jan 9 09:12:22 EST 2019


I like the idea of caching the system locale for future use. Too bad the 
std::locale is working so poorly on Windows :(

Op zondag 6 januari 2019 19:13:28 CET schreef John Ralls:
> +const std::locale&
> +gnc_get_locale()
> +{
> +  static std::locale cached;
> +  static bool tried_already = false;

If I understand it correctly using static variables makes the function 
unsuitable for multi-threading, right ?

Any idea how difficult would it be to fix that ?

I know GnuCash is not thread-safe by a long shot and gtk itself is single 
threaded so it doesn't matter that much.

However I silently set a personal goal of changing that sometime. The C code 
is a lost cause IMO, but it might be worth to keep multi-threading in mind as 
we gradually convert to c++. In my basic understanding of threading this 
particular function should not be too hard to make tread safe.

Geert




More information about the gnucash-devel mailing list