NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Investigate if thread is locked

Is it possible to see if a thrad is locked. I does not have the lock name (not even if one was specified).

 

I miss a function like "RunState.Thread.IsLocked". Does anyone know if it is possible to get this information?

 

Thanks Vagn

0 Kudos
Message 1 of 6
(5,442 Views)

Hi! Looking at the documentation online for the Lock Step, it appears that there are a few properties that only exist if a thread is locked. Lock Step documentation here shows that the Step.Result.TimeoutOccurred property only exists if the thread is locked. 

0 Kudos
Message 2 of 6
(5,438 Views)

Hi Chantastic

 

Thanks for the answer but this is only valid for the lock step. If for instance the lock has been done on a subsequence call and I need to figure out inside the sub sequence if the sequence is locked or a previous lock step has locked the thread this information is not available.

 

0 Kudos
Message 3 of 6
(5,413 Views)

That is not how thread synchronization is typically done. What exactly are you trying to do?

 

-Doug

0 Kudos
Message 4 of 6
(5,398 Views)

Hi Doug

 

Normally my customers use batchmodel for testing and (for some different reasons) needs to lock threads. Creating functions (typically a sub sequences or just a VI) for my customer i need, in some cases, to know if the thread is locked.

 

The customer has different options to lock the thread:

- "Lock" step

- "Use Lock to Allow....." in "Synchronization" under step properties

(- "Batch Synchronization -serial"  in "Synchronization" under step properties)

 

I can't use the suggestion by Chantastic! because I am not in the lock step and if the customer use the "Lock" in the synchronization tab the parameters does not exist.

 

Hope this answered your question Doug?

 

Vagn

 

0 Kudos
Message 5 of 6
(5,327 Views)

Threads themselves are not locked, but rather they own locks and they can own more than one. Why do you need to know if the thread owns a lock?

 

-Doug

0 Kudos
Message 6 of 6
(5,256 Views)