ccma14 commented on a change in pull request #831: ZOOKEEPER-3286: xid
wrap-around causes connection loss/segfault when hitting predefined XIDs
URL: https://github.com/apache/zookeeper/pull/831#discussion_r264014014
##########
File path: zookeeper-client/zookeeper-client-c/src/mt_adaptor.c
##########
@@ -502,13 +502,13 @@ int32_t fetch_and_add(volatile int32_t* operand, int
incr)
}
// make sure the static xid is initialized before any threads started
-__attribute__((constructor)) int32_t get_xid()
Review comment:
To clarify further:
A statement like
static int xid = 1;
even when within the scope of a function does NOT cause any MT issues, since
this places the variable into the initialized data section of the library,
hence this gets set when the library gets loaded.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services