I am trying to develop a code module that assigns a unique identity to something based on a barcode scan. Since there are multiple barcode readers I need make sure that only one event is firing at a time. I’m not exactly sure how threading works in ignition but here’s what I’m trying to do.
In the gateway startup events I’m defining a mutex that I will use later.
Then in a Gateway tag event I’m calling a code module that acquires the lock, does some work, then releases it. One note, we have only begun testing using a single gateway tag event per tag. Current testing is done simulating 5 barcode tags that can be written to at the same time (if not same time, very close to same time) However, I can’t seem to access the mutex set up in the gateway startup event in the code module.
for further detail, see attached pictures. Gateway tag events are roughly all the same but watch their own respective barcode tag. Each script under “MutexTestBar(x)” calls a code module within the project library that utilizes the paicMutex. At least thats what is being attempted
Is there somewhere else I should be creating the mutex or is there a better/different way to do this?