NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Lock Step- Dumb Question

Solved!
Go to solution

Very new TS user here.

 

Just stated looking at some Sequences that have been used at work before and they have been having problems with Run Time Errors popping up during database writes in a multithreaded test.

 

Do you have to have the checkbox checked under the synchronization properties to get Lock to actually work?

 

The settings only shows "Lock" when this box is checked. 

0 Kudos
Message 1 of 19
(814 Views)

Dumb question in return 😉

 

have you checked the examples?

0 Kudos
Message 2 of 19
(799 Views)

Thanks, I will when I get to the station.

0 Kudos
Message 3 of 19
(796 Views)

Most of  example code in the examples, "Sync Step Types- Lock.Step", are using Batch synchronization-One thread only.

 

This setting shows "Locked" in the Step window "Settings". When I change it to something else the Locked goes away.

 

The locks in the sequence I am looking at have no synchronization specified and do not have the check mark for "Use Lock to Allow One Thread at a Time".

 

The following step after the Lock calls a LV VI that writes to a database. The synchronization called out is "Use sequence file setting" which makes me wonder if there is really a Lock being invoked. 

 

We are getting errors when we try to write to the database. Multiple threads are running this sequence.

 

I cannot find an object reference that is doing any locking.

 

Is it possible to have a Lock in a step and not have it do anything?

0 Kudos
Message 4 of 19
(766 Views)

Sorry, that should read "Some of the  example code in the samples"

0 Kudos
Message 5 of 19
(763 Views)

This may not matter but the code writing to the database is non-reentrant. This means (to me) that the multiple threads trying to write to the database are going to somehow be queued up by Windows but I'm not an  expert.

0 Kudos
Message 6 of 19
(758 Views)

The Lock step settings will set the operation of the Lock (either Lock, Create, Unlock).  If you use "Lock" operation you can Create and Lock all in one step.  Also, Name the lock with a quoted string, ex. "myLock". The Lock step allow only one thread to access the database at a time.

0 Kudos
Message 7 of 19
(741 Views)

Yes I understand that. The question is, do you have to enter the check in the box to activate it?

 

Because if you don't the Lock does not show locked on the Step settings.

0 Kudos
Message 8 of 19
(721 Views)

Some snips:

subsolanus_0-1697118649739.png

 

0 Kudos
Message 9 of 19
(714 Views)

subsolanus_0-1697118798555.png

 

0 Kudos
Message 10 of 19
(713 Views)