From dev-return-80819-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Thu May 9 04:56:56 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 932CA180630 for ; Thu, 9 May 2019 06:56:56 +0200 (CEST) Received: (qmail 34100 invoked by uid 500); 9 May 2019 04:56:55 -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 34089 invoked by uid 99); 9 May 2019 04:56:55 -0000 Received: from Unknown (HELO mailrelay2-lw-us.apache.org) (10.10.3.159) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 May 2019 04:56:55 +0000 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by mailrelay2-lw-us.apache.org (ASF Mail Server at mailrelay2-lw-us.apache.org) with ESMTPSA id 7366E402D for ; Thu, 9 May 2019 04:56:55 +0000 (UTC) Received: by mail-ed1-f46.google.com with SMTP id m4so798208edd.8 for ; Wed, 08 May 2019 21:56:55 -0700 (PDT) X-Gm-Message-State: APjAAAV475pBF3wttmtK0uDGRY9z3gTbQkZvctwvxouhezEIkdcIuJaz VDncLplvbz2LDv0zKV6uBndzGeSjFyaD1jzji2Q= X-Google-Smtp-Source: APXvYqw1E7vJYNMRwrf2XZEo1lPwHtmW+OhYDNtluTWtrWdsSmBw3sxJ0MmRpaTLIXvjQr4ogQHsYj4BPw/7kZoi/Pc= X-Received: by 2002:a17:906:bcc9:: with SMTP id lw9mr1467749ejb.83.1557377814634; Wed, 08 May 2019 21:56:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Michael Han Date: Wed, 8 May 2019 21:56:43 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: why not disable sync API in libzkst.a? To: dev@zookeeper.apache.org Content-Type: multipart/alternative; boundary="0000000000006c243d05886d476f" --0000000000006c243d05886d476f Content-Type: text/plain; charset="UTF-8" Hi Shuxin, What's the zk client version you are testing? Sync apis were removed from c client in https://issues.apache.org/jira/browse/ZOOKEEPER-761, but it's only done for 3.5.3 and master branch only. There was a discussion in JIRA regarding whether or not to do the same for 3.4 branch which never concluded. Feel free to reopen the JIRA and submit a patch for 3.4 branch. On Mon, May 6, 2019 at 11:24 PM Shuxin Yang wrote: > Hi, > > I'm new to C API lib. I accidentally use single-thread lib (i.e. > libzkst.a) and it took me quit a while before I realize all sync > functions in the libzkst.a is not usable at all. I'm wondering why not > just disable them in libztst.a. It would otherwise be pretty confusing > and error-prone. > > Take zoo_get_children() as an example, it always return ZOK, and 0 > children. This function in turn calls zoo_wget_children_() which is > excerpted bellow. The wait_sync_completion() at line 3657 actually does > nothing in the single-thread version, meaning this function simply > return to the caller without waiting for the job done. > > Thanks > > Shuxin > > > -------------------------------------------------------------- > > 3646 static int zoo_wget_children_(...) > > 3650 struct sync_completion *sc = alloc_sync_completion(); > > .... > > 3655 rc= zoo_awget_children (zh, path, watcher, watcherCtx, > SYNCHRONOUS_MARKER, sc); > 3656 if(rc==ZOK){ > 3657 wait_sync_completion(sc); > 3658 rc = sc->rc; > 3659 if (rc == 0) { > 3660 if (strings) { > 3661 *strings = sc->u.strs2; > 3662 } else { > 3663 deallocate_String_vector(&sc->u.strs2); > 3664 } > 3665 } > 3666 } > 3667 free_sync_completion(sc); > 3668 return rc; > 3669 } > > ---------------------------------------------------------------- > > > --0000000000006c243d05886d476f--