miere43 / nim-registry

Deal with Windows Registry from Nim
http://miere.ru/docs/registry/
MIT License
29 stars 5 forks source link

nim-registry is not GC safe so cannot be used in spawn #4

Closed genotrance closed 7 years ago

genotrance commented 7 years ago

I'm trying to run a proc in parallel using spawn but it doesn't compile since winregistry is using a global variable:-

winregistry.nim(356, 6) Warning: 'queryMaxKeyLength' is not GC-safe as it accesses 'nullWinString' which is a global using GC'ed memory [GcUnsafe2]

This can be fixed by letting each proc have its own copy of nullWinString. There seem to be multiple instances of this:-

queryMaxKeyLength() countValues() countSubkeys()

miere43 commented 7 years ago

Works now?

genotrance commented 7 years ago

Yep works great, thanks!