Clovertech
› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Shareing file based counters between processes
Hi all,
Is there a way to share a file-based counter (the type created and used by the ctr* commands) between threads in different processes?
Kind regards,
Roland
Roland,
Yes. When you reference the counter, simply give it the full path to the counter file. i.e.
CtrNextValue /dirname/myCTR
Hope this helps.
Jim Cobane
Henry Ford Health
James:
Do you think this will cause contention when both threads make a call to access the shared counter file at the same time?
Russ Ross RussRoss318@gmail.com
There could be potential for contention as with any file-based activity. That consideration should be evaluated as part of Roland’s design.
If you use the Ctr* commands they have locking built-in. So contention should not be an issue.
Rob Abbott Cloverleaf Emeritus