LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CmtDiscardLock clarification

The help file (CVI 9.0) for CmtDiscardLock says: "If a thread currently owns the thread lock, this function waits for the thread to release the lock before uninitializing the lock."

 

The function, however, returns error -14931: You cannot discard a lock that is still owned

 

I'm guessing that CmtDiscardLock is not waiting until the other thread releases the lock before giving me this error message.....so my bet is that the help is wrong, and when I get this error, the lock is not being uninitialized....true? 

0 Kudos
Message 1 of 2
(2,888 Views)
The documentation should read "If another thread currently owns the thread lock, this function waits for the thread to release the lock before uninitializing the lock.". If the lock is currently held by the same thread that calls CmtDiscardLock, then the lock is released but you will get the error and the lock is not discarded - I think this is what you are seeing. If the lock is currently held by a different thread, then CmtDiscardLock will wait until the lock is released. I will make sure the documentation is changed to say another thread.
0 Kudos
Message 2 of 2
(2,852 Views)