Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Compare-and-swap
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Garry Shutler  
View profile  
 More options Oct 4 2012, 11:21 am
From: Garry Shutler <ga...@robustsoftware.co.uk>
Date: Thu, 4 Oct 2012 16:21:26 +0100
Local: Thurs, Oct 4 2012 11:21 am
Subject: Compare-and-swap

Hi,

I'm been looking at using redis to synchronize work between multiple
processes and I was surprised to see there wasn't a compare-and-swap
http://en.wikipedia.org/wiki/Compare-and-swap method available.

It's a well understood mechanism for synchronization and would make the
locking process described in http://redis.io/commands/setnx a bit better as
taking an expired lock would be done via CAS rather than GETSET which may
replace a lock someone else has put in place (and avoid two people taking
the same lock if they took it in the same millisecond). Also, it would make
expiring a lock you hold safer as you wouldn't delete a newly created lock
(had your lock expired), instead you could CAS the expiry date you set with
one in the past.

Does that make sense? Is this a desirable feature? Is there something I'm
overlooking?

I can look into creating a PR for this if needed but I don't know C so it
might take me a while.

Cheers,

Garry Shutler

www.robustsoftware.co.uk | @gshutler <http://twitter.com/gshutler>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.