[Bug 1517] mount does not use the provided filesystem handler table functions

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Tue Jun 8 07:29:10 UTC 2010


https://www.rtems.org/bugzilla/show_bug.cgi?id=1517





--- Comment #12 from Sebastian Huber <sebastian.huber at embedded-brains.de>  2010-06-08 02:29:09 ---
Yes, the file system area has problems with thread-safety, but this is new
code.

Problematic is the concurrent unregister of identical types.

It is difficult to get thread-safety right with the first() and next()
approach.  Since you return a reference to an object which may be deleted by
another entity you have to introduce some sort of reference counting.

obj = first() /* Increments the reference count */
while (obj != NULL) {
    /* Do something with obj */
    if (done) {
        release(obj) /* Decrements the reference count */
        break
    }
    obj = next(obj) /* Decrements the reference count */
}

The alternative is this:

bool visit(obj, arg)
{
    /* Do something with obj */
    return done
}

iterate(visit, arg) /* Uses a mutex to protect the iteration */

I don't see why this is difficult to use.  This approach works also well with
non-const references.

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list