NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone ever written a Prioritized Lock step type for TestStand?

I guess this is a question for the R&D guys mostly... but anyone who's used Locks is welcome!

I'm using TS 4.0 in a multiUUT system with a shared resource, and until recently have been having good results with standard Lock/Unlock style behavior. However we ran into a bit of a sore point recently when we realized that one of our parallel routines needed 'priority access' to the locked resource.

My scenario is this: 

I have 3 "Normal" parallel actions taking place that share a COM port very happily.  There is a 4th action called "ASAP" that intermittently pops up and needs access the same port. In a worst case scenario, the three other sequences would already be either (1) using the lock or (2) waiting for the lock.

From what I've been able to observe from the behavior, my 4th sequence seems to just 'get in line'  regardless of the thread priority set. (Am I misunderstanding the existing behavior?) 

What I want is for the "ASAP" thread to issue a "Lock Me First" sort of command, where it would wait along with the others until the current sequence using the lock releases it, but then the "ASAP" lock would be handled next regardless of who else was waiting, how long they were waiting, or their thread priority.

After poking a bit at the existing Lock step type in TS it seemed that there wasn't a built-in way to do something like this.  So, I opted to go write my own functional global & LV server solution. The functional global is called with an assortment of Lock-style commands per sequence and handles the wait/go side of things. The mini LV server does basically a queue of pointers to the various steps in sequences and keeps track of timeouts and 'who has the lock' etc.  It acts like a regular Lock in most situations, but has a "Priority Lock" command in addition to the standard "Lock".

Is this something that anyone else has ever encountered before? Care to share how you implemented it? The solution I came to works, but it was a bit cumbersome to code.  I know that the point of locks is 'first come first serve' in terms of parallelism, but it might be nice if they were either thread priority conscious, or if there was some ranking system we could put in place at an advanced level.  I hate to think I've rebuilt something already in TestStand!

- Cheers

Elaine R.
www.bloomy.com

Cheers,
Elaine R.
www.bloomy.com
0 Kudos
Message 1 of 3
(3,026 Views)

Hi Elaine,

I can verify that there is no existing way create a "prioritized lock" in TestStand without implementing a custom solution. Though I haven't seen this kind of lock implemented in the past, I think that your method sounds like a good way of implementing this behavior.

This definitely sounds like a useful feature, so I will submit a product suggestion to our R&D department. Hopefully we will see this option in a future version of TestStand!

Regards,

Casey Weltzin
Applications Engineer
National Instruments

0 Kudos
Message 2 of 3
(3,002 Views)

An easy way to do the priority locks would be to use 2 locks 
One for the general priority and another for the ASAP
For general priority you would then lock the normal and then the ASAP do everything and then unlock it both
if you are the the ASAP u will just use the ASAP lock 
This means that the ASAP is always first at the ASAP lock, since the others are stuck at the normal lock 

0 Kudos
Message 3 of 3
(262 Views)