ZhengweiZhu commented on code in PR #3158:
URL: https://github.com/apache/brpc/pull/3158#discussion_r2548279327
##########
src/bthread/types.h:
##########
@@ -97,12 +97,14 @@ typedef struct {
size_t nfree;
} bthread_keytable_pool_stat_t;
+static const size_t BTHREAD_NAME_MAX_LENGTH = 31;
// Attributes for thread creation.
typedef struct bthread_attr_t {
bthread_stacktype_t stack_type;
bthread_attrflags_t flags;
bthread_keytable_pool_t* keytable_pool;
bthread_tag_t tag;
+ char name[BTHREAD_NAME_MAX_LENGTH + 1]; // do not use std::string to keep
POD
Review Comment:
For static constants like BTHREAD_ATTR_NORMAL, the name field is all
initialized with {0}, which sets all elements of the array (including the last
one) to zero. so user is not required to set name and the name will be printed
as empty string, which is backward compatibility
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]