You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "James Peach (JIRA)" <ji...@apache.org> on 2013/01/31 18:17:13 UTC
[jira] [Commented] (TS-1678) Unnecessary lock releasing in
RecRegisterStat()
[ https://issues.apache.org/jira/browse/TS-1678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13567827#comment-13567827 ]
James Peach commented on TS-1678:
---------------------------------
Yes I agree. I think that the 'release_record_lock' parameter to register_record() is unnecessarily complicated. Can you also simplify or remove that?
> Unnecessary lock releasing in RecRegisterStat()
> -----------------------------------------------
>
> Key: TS-1678
> URL: https://issues.apache.org/jira/browse/TS-1678
> Project: Traffic Server
> Issue Type: Improvement
> Components: Stats
> Reporter: Yunkai Zhang
>
> It seems that lock releasing in the following code is unnecessary and dangerous in some situation.
> {code}
> //-------------------------------------------------------------------------
> // RecRegisterStat
> //-------------------------------------------------------------------------
> RecRecord *
> RecRegisterStat(RecT rec_type, const char *name, RecDataT data_type, RecData data_default, RecPersistT persist_type)
> {
> RecRecord *r = NULL;
> ink_rwlock_wrlock(&g_records_rwlock);
> if ((r = register_record(rec_type, name, data_type, data_default, false)) != NULL) {
> r->stat_meta.persist_type = persist_type;
> rec_mutex_release(&(r->lock)); //dangerous!!
> } else {
> ink_debug_assert(!"Can't register record!");
> }
> ink_rwlock_unlock(&g_records_rwlock);
> return r;
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira