From 65819f3b9f8229666a30b91ef2d289ebc6085097 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Sun, 11 Jun 2017 13:58:43 +0200 Subject: Use thread_local instead from some static settings (#5955) thread_local permits to limit variable lifetime to thread duration. Use it on each setting place which uses static to cache variable result only for thread lifetime. This permits to keep the same performance level & reconfigure server from MT gui in those various variables places. Add thread_local to undersampling calculation too. --- src/drawscene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/drawscene.cpp') diff --git a/src/drawscene.cpp b/src/drawscene.cpp index 59f9b8375..2cf9689a8 100644 --- a/src/drawscene.cpp +++ b/src/drawscene.cpp @@ -474,7 +474,7 @@ void draw_plain(Camera &camera, bool show_hud, // Undersampling-specific stuff static video::ITexture *image = NULL; static v2u32 last_pixelated_size = v2u32(0, 0); - int undersampling = g_settings->getU16("undersampling"); + static thread_local int undersampling = g_settings->getU16("undersampling"); v2u32 pixelated_size; v2u32 dest_size; if (undersampling > 0) { -- cgit v1.2.3