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 <[email protected]> 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 } > > ---------------------------------------------------------------- > > >
