From eb0a568a740eac60f0f2de770c9a99d8c5174fd2 Mon Sep 17 00:00:00 2001 From: void* Date: Tue, 8 Aug 2023 15:35:04 +0200 Subject: [PATCH] [Cosmetic]: Municipal Inflation Cache: update code comment (#163) --- x/mint/cache/municipal_inflation_cahe.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/x/mint/cache/municipal_inflation_cahe.go b/x/mint/cache/municipal_inflation_cahe.go index f260f178ba..7952910101 100644 --- a/x/mint/cache/municipal_inflation_cahe.go +++ b/x/mint/cache/municipal_inflation_cahe.go @@ -19,12 +19,16 @@ type MunicipalInflationCache struct { } var ( - // NOTE(pb): This is *NOT* thread safe. - // However, in our case, this global variable is by design - // *NOT* supposed to be accessed simultaneously in multiple - // different threads, or in global scope somewhere else. - // Once such requirements arise, concept of this global variable - // needs to be changed to something what is thread safe. + // GMunicipalInflationCache Thread safety: + // As the things stand now from design & impl. perspective: + // 1. This global variable is supposed to be initialised(= its value set) + // just *ONCE* here, at this place, + // 2. This global variable is *NOT* used anywhere else in the initialisation + // context of the *global scope* - e.g. as input for initialisation of + // another global variable, etc. ... + // 3. All *exported* methods of `MunicipalInflationCache` type *ARE* thread safe, + // and so can be called from anywhere, *EXCEPT* from the initialisation context + // of the global scope(implication of the point 2 above)! GMunicipalInflationCache = MunicipalInflationCache{} )