More ToUserDevice nits

This fixes a pair of races and a memory leak, all related to having a ToUserDevice/FromUserDevice open when the /click/config is reloaded.
Smarter I think to leave it where it is for now...



On Mon, Jul 28, 2014 at 1:06 PM, pallas <notifications@github.com> wrote:

> In elements/linuxmodule/touserdevice.cc:
>
> > @@ -68,9 +70,19 @@ struct pcaprec_hdr {
> >      uint32_t orig_len;	     /* actual length of packet */
> >  };
> >
> > +template <typename T>
> > +class ref_holder {
> > +public:
> > +    explicit ref_holder(T & t) : t_(t) { }
> > +    ~ref_holder() { --t_; }
> > +private:
> > +    T & t_;
> > +};
> > +
>
> Agreed. I can move it to somewhere in include/click/ but it seemed a
> little too small to give it its own header. The destructor also isn't
> really generic, so any sub-class doing the same work of a more generic
> template would be almost as big inline as the template itself.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/kohler/click/pull/124/files#r15475268>.
>