diff options
author | 2023-07-10 13:56:14 +0200 | |
---|---|---|
committer | 2023-07-10 12:56:14 +0100 | |
commit | f0dad439f6493e6aa8e17d1dd9c13eafa76fc9f6 (patch) | |
tree | 1eb0e78230b5bd7ff4e3391dc1a3dab062dc5b1f /internal/config/gen/gen.go | |
parent | [chore]: Bump golang.org/x/net from 0.11.0 to 0.12.0 (#1973) (diff) | |
download | gotosocial-f0dad439f6493e6aa8e17d1dd9c13eafa76fc9f6.tar.xz |
[feature] Use Read/Write lock for config (#1969)
Diffstat (limited to 'internal/config/gen/gen.go')
-rw-r--r-- | internal/config/gen/gen.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/config/gen/gen.go b/internal/config/gen/gen.go index 1c2c11747..bd7899a78 100644 --- a/internal/config/gen/gen.go +++ b/internal/config/gen/gen.go @@ -105,9 +105,9 @@ func generateFields(output io.Writer, prefixes []string, t reflect.Type) { // ConfigState structure helper methods fmt.Fprintf(output, "// Get%s safely fetches the Configuration value for state's '%s' field\n", name, fieldPath) fmt.Fprintf(output, "func (st *ConfigState) Get%s() (v %s) {\n", name, fieldType) - fmt.Fprintf(output, "\tst.mutex.Lock()\n") + fmt.Fprintf(output, "\tst.mutex.RLock()\n") fmt.Fprintf(output, "\tv = st.config.%s\n", fieldPath) - fmt.Fprintf(output, "\tst.mutex.Unlock()\n") + fmt.Fprintf(output, "\tst.mutex.RUnlock()\n") fmt.Fprintf(output, "\treturn\n") fmt.Fprintf(output, "}\n\n") fmt.Fprintf(output, "// Set%s safely sets the Configuration value for state's '%s' field\n", name, fieldPath) |