[ 
https://issues.apache.org/jira/browse/TS-2943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14068025#comment-14068025
 ] 

Alan M. Carroll commented on TS-2943:
-------------------------------------

Yeah, naming was a big issue. {{ats_scoped_st}} is a long string compared to 
the original suggested name {{xstr}}. I, personally, am fine with 
{{ats_scoped_string}}. I did like how {{ats_scoped_str matches}} "_obj" and 
"_mem", though.

The ability to construct a scoped string with a size is a feature I quite like. 
That's how {{xptr}} works and a standard sort of thing to do for a string. It's 
marked explicit so it should be sufficiently safe.

As for the "ats_" prefix, I thought we'd agreed to use that but I could be 
wrong. I would prefer putting them in a namespace and doing a local alias

{code}
namespace apache_traffic_server { ... }
namespace ats = apache_traffic_server
{code}

I will put the traits in a nested namespace {{detail}}. I'll look at encoding 
the resource type as well.

Removing xfd and xptr is a goal of this effort. This should be a more than 
sufficient replacement for those.

Yes, ats_scoped_fd should probably use {{TRAITS::isValid()}}. Trying to 
micro-optimize.

The inherited assignment operators are not found or are ambiguous. If they are 
not defined in the concrete classes things will break (for instance 
{{ats_scoped_fd fd = open(...);}} won't work because it will try to use the 
copy constructor instead).


> Add scoped resource class to help clean up resource leaks.
> ----------------------------------------------------------
>
>                 Key: TS-2943
>                 URL: https://issues.apache.org/jira/browse/TS-2943
>             Project: Traffic Server
>          Issue Type: New Feature
>          Components: Core
>            Reporter: Alan M. Carroll
>         Attachments: ts-2943.diff
>
>
> Create a set of template classes to handle contingently allocated resources 
> in a cleaner and more robust way. This holds the resource and destroys it if 
> it goes out of scope, with the ability to release the resource after all 
> contingent checks have been done. It is modeled on the current xptr class but 
> with more generality and better naming.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to