> Sorry, my humor got the better of me. You should add a few comment
> regarding the locking through v4l open. YOur relienance on it makes
> it very subtle and impossible to understand without comments.
> The code itself is very well.

Absolutely. Once there are no more problems with the code, I'll document
it before trying to send it on to Greg.

Maybe it would just be better to hold the busy mutex through the open call
to make it explicit.

> > Well, I found one between disconnect and release. I'm hoping this fixes
> > that race as well as the abusive use of semaphores you mentioned.
>
> What did you change?

Release used to look like:
        if disconnected
                wait for disconnect complete
                free memory
        else
                mark camera as not in use


if the camera was disconnected after the check but before the camera was
marked as not in use, then no one would free the memory. disconnect would
still see a user, and release still thinks the camera is plugged in. since
release now takes the busy mutex, it keeps disconnect from racing straight
through in that case.

Release now does:
        down mutex

        if disconnected
                up mutex
                wait for disconnect
                free memory
        else
                mark camera as not in use
                up mutex

-- John



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to