Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2011 23:14:36 +0200
From:      Bartosz Fabianowski <freebsd@chillt.de>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Kostik Belousov <kostikbel@gmail.com>, freebsd-hackers@freebsd.org, Hans Petter Selasky <hselasky@c2i.net>
Subject:   Re: Is there some implicit locking of device methods?
Message-ID:  <4DB8873C.5020608@chillt.de>
In-Reply-To: <201104271334.07170.jhb@freebsd.org>
References:  <4DB695DB.1080505@chillt.de> <201104271019.31844.jhb@freebsd.org> <4DB818A3.1020104@chillt.de> <201104271334.07170.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> If you have some sort of state that needs to get created on first
> open and then removed on last close [...] I would still depend on the
> cdevpriv destructor and use a reference count between open() and the
> destructor to know when to cleanup shared state.

Yes, this is what I am doing. I am maintaining a list of all file 
descriptors open on the device. Once the length of that list reaches 
zero, I do global clean-up in the cdevpriv destructor.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4DB8873C.5020608>