X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Fmem_mheap.c;h=f3387b7241778f9e107e5c596b9ae7a1895f2536;hb=6a5adc369591fcac2447e9809deaa22f56b53911;hp=9b2af520ca658f253bcd049bdb096b55a4c9ae31;hpb=2a3fb1a28b170ac1d37815983611e83d148811d4;p=vpp.git diff --git a/src/vppinfra/mem_mheap.c b/src/vppinfra/mem_mheap.c index 9b2af520ca6..f3387b72417 100644 --- a/src/vppinfra/mem_mheap.c +++ b/src/vppinfra/mem_mheap.c @@ -95,6 +95,25 @@ clib_mem_init (void *memory, uword memory_size) return heap; } +void * +clib_mem_init_thread_safe (void *memory, uword memory_size) +{ + mheap_t *h; + u8 *heap; + + clib_mem_init (memory, memory_size); + + heap = clib_mem_get_per_cpu_heap (); + ASSERT (heap); + + h = mheap_header (heap); + + /* make the main heap thread-safe */ + h->flags |= MHEAP_FLAG_THREAD_SAFE; + + return heap; +} + #ifdef CLIB_LINUX_KERNEL #include