12-04-2020 04:24 PM
I have a LabWindows/CVI 2017 app that does I2C communication using an FTDI 4222 DLL.
I have been trying to debug a communication problem, and I run into a situation where my application hangs in the debugger. When I click "STOP" it shows a CmtGetLock call in red. "GO" only hangs, and "STOP" returns to the same call.
Does CmtGetLock () hang? I thought it just tried to get the lock and returned an error if the lock was already in use?
Regardless, when this happens, I cannot abort my program, or even kill it in Task Manager. I end up having to reboot this PC.
This is a new issue -- and I have not seen the debugger behave like this.
Any suggestions where I should look?
12-04-2020 06:30 PM
As you can see in the help for the function, CmtGetLock () indeed hangs, i.e. waits forever for the lock to be free.
As an alternative you can use CmtTryToGetLock () which does not hang or GmtGetLockEx () which permits you to add a timeout (the help explains how to setup the code in this case)
12-14-2020 10:32 AM
Thanks -- I had a real rough day where it would hang at the lock and take the entire PC down (no way to exit without restarting). That happened a number of times one day, but now seems to have gone away so I'll just revisit that if it shows up again.