I know the Thread and synchronize functionality allows me to lock objects between multiple threads within the same process, but is there anyway to lock an object between processes?
Case Study: Process A calls class AccessResource. It utilises this class for 10 seconds before ending. Process B calls class AccessResource. It cannot access it because class A is using it, and it is locked. It waits for it to be freed, then uses it itself.
posted 10 years ago
I think you'll have to make the processes talk to each other or some shared external resource manager. We had this conversation on the ranch once before and I thought if the two processes already share a database the database might make a good manager because it has good ACID operations. Flags on a shared file system might be tempting, but I'm not sure they would be reliable. I have a design in my drawer for a resource manager process that a friend did about 20 years ago. Maybe I should dig that out.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi