lkml.org 
[lkml]   [2003]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: Setjmp/Longjmp in the kernel?
    On Wed, Feb 12, 2003 at 11:55:32AM +0100, Kasper Dupont wrote:
    > Olaf Titz wrote:
    > >
    > > Not that this matters any bit, but the proper order is of course
    > > alloc this
    > > alloc that
    > > _foo_func()
    > > free that
    > > free this
    > >
    > > even if only for aesthetical reasons :-)
    > >
    > > (with locks, it does matter...)
    >
    > For locks it is only when you lock the order matters, not when
    > you unlock. For allocations there is of course the possibility
    > that the first allocation suceeds and the second fails, which
    > you must handle in some way.

    The usual way is with "pools".

    Every resource allocated after a "mark" point gets dumped into
    a separate pool, and then when processing returns to the mark
    point, the pools are drained, one way or the other.

    For locks, the pools are ordered, and you swim backwards through
    the pool.

    John S.
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:33    [W:0.031 / U:0.108 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site