Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1BB8A200CD7 for ; Tue, 1 Aug 2017 17:43:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 19D94167651; Tue, 1 Aug 2017 15:43:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5E79B16764C for ; Tue, 1 Aug 2017 17:43:05 +0200 (CEST) Received: (qmail 7232 invoked by uid 500); 1 Aug 2017 15:43:04 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 7221 invoked by uid 99); 1 Aug 2017 15:43:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Aug 2017 15:43:04 +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 DA00718072C for ; Tue, 1 Aug 2017 15:43:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id W3c2hMUxLF3I for ; Tue, 1 Aug 2017 15:43:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id A224D5FDB5 for ; Tue, 1 Aug 2017 15:43:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 48FE2E0295 for ; Tue, 1 Aug 2017 15:43:02 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id CC09F2465A for ; Tue, 1 Aug 2017 15:43:00 +0000 (UTC) Date: Tue, 1 Aug 2017 15:43:00 +0000 (UTC) From: "Michael Han (JIRA)" To: dev@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ZOOKEEPER-1643) Windows: fetch_and_add not 64bit-compatible, may not be correct MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 01 Aug 2017 15:43:06 -0000 [ https://issues.apache.org/jira/browse/ZOOKEEPER-1643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16109119#comment-16109119 ] Michael Han commented on ZOOKEEPER-1643: ---------------------------------------- cherry picked to branch-3.4: https://github.com/apache/zookeeper/commit/7956f138a781b2b4bd166c50e49bbad83d40c2a8 > Windows: fetch_and_add not 64bit-compatible, may not be correct > --------------------------------------------------------------- > > Key: ZOOKEEPER-1643 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1643 > Project: ZooKeeper > Issue Type: Bug > Components: c client > Affects Versions: 3.3.3 > Environment: Windows 7 > Microsoft Visual Studio 2005 > Reporter: Erik Anderson > Assignee: Erik Anderson > Fix For: 3.5.0, 3.4.11 > > Attachments: mt_adaptor.c.patch > > > Note: While I am using a really old version of ZK, I did do enough "SVN Blame" operations to realize that this code hasn't changed. > I am currently attempting to compile the C client under MSVC 2005 arch=x64. There are three things I can see with fetch_and_add() inside of /src/c/src/mt_adapter.c > (1) MSVC 2005 64bit will not compile inline _asm sections. I'm moderately sure this code is x86-specific so I'm unsure whether it should attempt to either. > (2) The Windows intrinsic InterlockedExchangeAdd [http://msdn.microsoft.com/en-us/library/windows/desktop/ms683597(v=vs.85).aspx] appears to do the same thing this code is attempting to do > (3) I'm really rusty on my assembly, but why are we doing two separate XADD operations here, and is the code as-written anything approaching atomicity? > If you want an official patch I likely can do an SVN checkout and submit a patch the replaces the entire #else on lines 495-505 with a "return InterlockedExchangeAdd(operand, incr);" > Usually when I'm scratching my head this badly there's something I'm missing though. As far as I can tell there has been no prior discussion on this code. -- This message was sent by Atlassian JIRA (v6.4.14#64029)