ghw icon indicating copy to clipboard operation
ghw copied to clipboard

On my windows, sometimes it show error: Cannot change thread mode after it is set

Open longit123 opened this issue 1 year ago • 7 comments

ghw version: v0.10.0 GPU: RTX3070 Win10: 21H2 19044.1889 Go version: 1.19.6

longit123 avatar Mar 20 '23 12:03 longit123

it is easy to appear after calling multiple times

gpu, err := ghw.GPU()

longit123 avatar Mar 20 '23 13:03 longit123

@longit123 does this only happen when calling the GPU function or does this happen when you call any ghw function on Windows?

jaypipes avatar Mar 20 '23 14:03 jaypipes

I am using wails + front-end development. Wails will monitor file updates during development and then perform hot updates. When I did not use ghw before, this problem did not occur. After using ghw, this problem will appear. After I Googled it, it may be due to the use of wails webview2, caused by hot update, I don't know how to solve this problem

longit123 avatar Mar 21 '23 04:03 longit123

https://wails.io/docs/howdoesitwork/

longit123 avatar Mar 21 '23 04:03 longit123

ghw does not write any files so I don't believe the file monitoring that Wails (or Vite) does is part of this. I suspect this may be a problem with the go-ole/go-ole library that the StackExchange/wmi dependency uses. Unfortunately, I don't know if there's anything that ghw can do to address this issue :(

jaypipes avatar Mar 21 '23 16:03 jaypipes

Please see this related thread in another project that uses WMI/go-ole:

https://github.com/shirou/gopsutil/issues/692

jaypipes avatar Mar 21 '23 16:03 jaypipes

I think I solved this by calling hardwareID functions inside a goroutine that I lock on thread (runtime.LockOSThread)

matwachich avatar May 08 '23 13:05 matwachich