lock init
authorJingLiuZTE <[email protected]>
Wed, 8 Nov 2017 07:35:01 +0000 (15:35 +0800)
committerFlorin Coras <[email protected]>
Thu, 9 Nov 2017 02:10:15 +0000 (02:10 +0000)
writer_lock must be inited before used.

Change-Id: Ib258aa09b3bccc4de6edba0eb75a7eec20f1a61f
Signed-off-by: JingLiuZTE <[email protected]>
(cherry picked from commit 4c9f2a805038a2d4f663b05a3d08ac4ee1eec3da)

src/vppinfra/bihash_template.c

index 2a5a5cd..56c410b 100644 (file)
@@ -35,6 +35,7 @@ void BV (clib_bihash_init)
   vec_validate_aligned (h->buckets, nbuckets - 1, CLIB_CACHE_LINE_BYTES);
   h->writer_lock = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES,
                                           CLIB_CACHE_LINE_BYTES);
+  h->writer_lock[0] = 0;
 
   for (i = 0; i < nbuckets; i++)
     BV (clib_bihash_reset_cache) (h->buckets + i);