Re: [patch] turning devctl into a "multiple openable" device

From: Olivier Houchard <mlfbsd_at_kanar.ci0.org>
Date: Wed, 30 Nov 2011 17:20:17 +0100
On Wed, Nov 30, 2011 at 06:04:50PM +0200, Kostik Belousov wrote:
> > > I wonder why the waiting_threads stuff is needed at all. The cv could
> > > be woken up unconditionally everytime. What is the reason for the cv_wait
> > > call in cdevpriv data destructor ? You cannot have a thread doing e.g.
> > > read on the file descriptor while destructor is run.
> > > 
> > 
> > What will prevent you from having a thread stuck in read(), while an another 
> > one close() the fd ?
> > 
> Nothing, but file reference count goes to zero only after the thread
> stuck in read is unstuck. Cdevpriv destructor is run only when file
> reference count becomes zero, i.e. there can be no any accessing threads,
> and new accesses are impossible since file descriptors also own references
> on the file.

Right, I was a bit confused, this part can be removed.

Regards,

Olivier
Received on Wed Nov 30 2011 - 15:20:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:21 UTC