stack: introduce stack library
[dpdk.git] / doc / guides / prog_guide / stack_lib.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2019 Intel Corporation.
3
4 Stack Library
5 =============
6
7 DPDK's stack library provides an API for configuration and use of a bounded
8 stack of pointers.
9
10 The stack library provides the following basic operations:
11
12 *  Create a uniquely named stack of a user-specified size and using a
13    user-specified socket.
14
15 *  Push and pop a burst of one or more stack objects (pointers). These function
16    are multi-threading safe.
17
18 *  Free a previously created stack.
19
20 *  Lookup a pointer to a stack by its name.
21
22 *  Query a stack's current depth and number of free entries.
23
24 Implementation
25 ~~~~~~~~~~~~~~
26
27 The stack consists of a contiguous array of pointers, a current index, and a
28 spinlock. Accesses to the stack are made multi-thread safe by the spinlock.