Return-Path: X-Original-To: apmail-ignite-dev-archive@minotaur.apache.org Delivered-To: apmail-ignite-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DB4BD17DEF for ; Thu, 17 Sep 2015 13:20:21 +0000 (UTC) Received: (qmail 61320 invoked by uid 500); 17 Sep 2015 13:20:21 -0000 Delivered-To: apmail-ignite-dev-archive@ignite.apache.org Received: (qmail 61275 invoked by uid 500); 17 Sep 2015 13:20:21 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 61259 invoked by uid 99); 17 Sep 2015 13:20:21 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Sep 2015 13:20:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 1D7241809AC for ; Thu, 17 Sep 2015 13:20:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.001 X-Spam-Level: *** X-Spam-Status: No, score=3.001 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id qwogz5dG5ghd for ; Thu, 17 Sep 2015 13:20:06 +0000 (UTC) Received: from mail-ig0-f175.google.com (mail-ig0-f175.google.com [209.85.213.175]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id DF82E20F1E for ; Thu, 17 Sep 2015 13:20:05 +0000 (UTC) Received: by igxx6 with SMTP id x6so13633115igx.1 for ; Thu, 17 Sep 2015 06:20:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=dkd5Gag2BgshIYKeQDUWbqrOqlVFErm8YjrQXqWeVpY=; b=fxM9gcDpv2uFITzHojNCPh6ZV/2nQ0GO8Ka4OOhk7VYlgh+wUhKdQiZNinbJVnCVdU 9NY8xoO5S+BaioVmfPGCJrkEvn8YK4VYp4JNFvZ0PkPaARjhXaMTqOVD2LUzyRJNj0jb YthtJ9TswHr9pqEo6KRr8ctFUfc5YoHPhlCwJNCPzsE5E9r86QbjYpKFKZfJT1BG7VTV fmZ71XE1YN4pFE8zNS2rt+/ew9sFp1Xl0pV1lyGZtExBZBhcCCMZ4FBdReB/xKOARs0C u8suJTTWUV/18Pi0/bPrHBl5sRqX2LPTQLyPgN7Py1TJY6dHaWjZme8NpRL3R9zYHHgu jt7w== X-Gm-Message-State: ALoCoQk3oAoDJnpHPLzUiWpx7Znvvywy6CCryyN+yeW6jxoP3knr/0zaSumSb/HFQk0YRVnm0LN6 X-Received: by 10.50.45.10 with SMTP id i10mr6047641igm.70.1442496005383; Thu, 17 Sep 2015 06:20:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.9.138 with HTTP; Thu, 17 Sep 2015 06:19:35 -0700 (PDT) In-Reply-To: References: From: Pavel Tupitsyn Date: Thu, 17 Sep 2015 16:19:35 +0300 Message-ID: Subject: Re: Adding compare-and-set method returning value to distributed atomics To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=089e010d9a84fdc8a6051ff14528 --089e010d9a84fdc8a6051ff14528 Content-Type: text/plain; charset=UTF-8 Hi, Looking at other methods in IgniteAtomicLong, it would be compareAndSetAndGet. Ugly, but consistent. On Thu, Sep 17, 2015 at 3:36 PM, Vladimir Ozerov wrote: > Igniters, > > As we know Java implementation of atomics are rather limited because it > cannot return current value in case of failed CAS. Other modern platforms > like .Net, WinAPI and GCC have this feature. > > We can easily implement this method because we have old value in hands > during distributed CAS. But how to name it? > > - long compareAndSetValue(long, long)? > - compareAndSetReturnValue(long, long)? > > Please share your ideas. > > For examples, GCC goes this way: > __sync_*bool*_compare_and_set > __sync_*val*_compare_and_set > > Vladimir. > -- -- Pavel Tupitsyn GridGain Systems, Inc. www.gridgain.com --089e010d9a84fdc8a6051ff14528--