[prev in list] [next in list] [prev in thread] [next in thread]
List: openldap-technical
Subject: Re: Counter concurrency access
From: Howard Chu <hyc () symas ! com>
Date: 2024-03-06 16:53:22
Message-ID: 83858c6a-b5b9-6268-e3cb-4ae6ec530dd9 () symas ! com
[Download RAW message or body]
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.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic