The first item might be implemented like this:
type DataWithLock = object
dataLock*: Lock
data* {.guard: dataLock.}: AppData
RunI'm not sure that guard will work without type definition, but it might.(never did so myself) It will compile with --threads:on only and will warn you if you are accessing to data without locking.
