MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _shm_id_alloc

Function _shm_id_alloc

components/lwp/lwp_shm.c:83–98  ·  view source on GitHub ↗

* Try to allocate an structure 'lwp_shm_struct' from the freed list or the * static array. */

Source from the content-addressed store, hash-verified

81 * static array.
82 */
83static int _shm_id_alloc(void)
84{
85 int id = -1;
86
87 if (shm_free_list != -1) /* first try the freed list */
88 {
89 id = shm_free_list;
90 shm_free_list = (int)_shm_ary[shm_free_list].addr; /* single-direction */
91 }
92 else if (shm_id_used < RT_LWP_SHM_MAX_NR) /* then try the array */
93 {
94 id = shm_id_used;
95 shm_id_used++;
96 }
97 return id;
98}
99
100/* Release the item in the static array to the freed list. */
101static void shm_id_free(int id)

Callers 1

_lwp_shmgetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected