10-11-2023 10:54 AM
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.
Solved! Go to Solution.
10-11-2023 11:45 AM
Dumb question in return 😉
have you checked the examples?
10-11-2023 11:54 AM
Thanks, I will when I get to the station.
10-11-2023 03:33 PM
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?
10-11-2023 03:36 PM
Sorry, that should read "Some of the example code in the samples"
10-11-2023 03:46 PM
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.
10-11-2023 06:11 PM
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.
10-12-2023 07:12 AM
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.
10-12-2023 08:51 AM
Some snips:
10-12-2023 08:53 AM