diff options
author | Richard Braun <rbraun@sceen.net> | 2018-02-06 20:45:45 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-02-07 01:08:53 +0100 |
commit | c04a26ee892d440979a84b891d6fac14cd4686f1 (patch) | |
tree | 0f59f0c1258f694d8a460e2ae6a874e8b002fa56 /kern/sref.c | |
parent | 6db72a1aeaddf038b12490fe9310a10693ffbf7a (diff) |
kern/sref: allow custom initial values
Diffstat (limited to 'kern/sref.c')
-rw-r--r-- | kern/sref.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kern/sref.c b/kern/sref.c index 404d993..f145f80 100644 --- a/kern/sref.c +++ b/kern/sref.c @@ -991,13 +991,16 @@ sref_report_periodic_event(void) void sref_counter_init(struct sref_counter *counter, + unsigned long init_value, struct sref_weakref *weakref, sref_noref_fn_t noref_fn) { + assert(init_value != 0); + counter->noref_fn = noref_fn; spinlock_init(&counter->lock); counter->flags = 0; - counter->value = 1; + counter->value = init_value; counter->weakref = weakref; if (weakref) { |