lkml.org 
[lkml]   [2017]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return functions
On Fri, Sep 01, 2017 at 11:51:53PM +0100, David Howells wrote:
> Peter Zijlstra <peterz@infradead.org> wrote:
>
> > if (obj) {
> > /* use obj */
> > refcount_dec(&obj->refs); /* should never hit 0 */
> > }
>
> You've missed a bit: We need to tell the gc to run when we reduce the refcount
> to 1:
>
> if (obj) {
> ...
> if (refcount_dec_return(&obj->refs) == 1)
> schedule_gc();
> }

Ah, so that isn't fundamental to having a GC. But yes if that's your
requirement, then this makes sense.

Please clarify in the Changelog.

\
 
 \ /
  Last update: 2017-09-04 09:30    [W:0.063 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site