Pascal Jakobi wrote:
Hi there
I am creating a program that needs to increment a counter. Typically a serial number has to be incremented every time I create a certificate.
The problem is to handle concurrent access. Fundamentally I need to 1/ read the counter 2/ increment it. Therefore no one must be provided access to the counter during these two operations.
Therefore I need to set a lock before the read operation and release it after the update. Is there a way to do this with OL ? I am conscious of the ldapmodify features thanks to Clement, however, this will not lock the read.
You don't need to do any locking, just use the ldapmodify Increment operator and the value will be incremented atomically.