Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel Device Creation - How to avoid Locking Issue

Former Member
0 Kudos

Hi All,

I am using 'ENQUEUE_EIMASE' and 'DEQUEUE_EIMASE' to lock the MASE table inorder fetch the current serial number for a particular Device Category . Then this serial number is increased by one and FM 'READ_MASE' is used to save the new serial number in MASE database table.

This works when we are creating just one device at a time for a particular device category.

But if for the same device category am trying to creat devices parallelly through same program or differrent program, then its not working properly.

For Eg:

I am trying to 3 create devices for the same device category simultaneously through different programs, then only for first one which has obtained the lock on MASE table am obtaining the serial number . And for the other 2 locking of table fails.

Could you guide me to solve this issue?

1 REPLY 1

Former Member
0 Kudos

This is not an issue, while the record is being locked by program 1, it cannot be locked by program 2 simultaneously. Thats why we use locking mechanisms. You need to intoduce some time based mechanism like waiting for the first program to complete, or event based method, like keep on trying to lock the record in a loop, untill it gets successfully locked (After the lock is released by program one). Also remember to unlock all the records you lock in your program at the last, though they get unlocked automatically.

Thanks,

Saravanan Rajan