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

Function lwp_children_register

components/lwp/lwp.c:367–383  ·  view source on GitHub ↗

* @brief Register a child process with its parent * * @param[in] parent Pointer to the parent process structure * @param[in] child Pointer to the child process structure to register * * @return RT_EOK on success * * @note This function adds a child process to its parent's children list and * increases reference counts for both processes. */

Source from the content-addressed store, hash-verified

365 * increases reference counts for both processes.
366 */
367rt_err_t lwp_children_register(struct rt_lwp *parent, struct rt_lwp *child)
368{
369 /* lwp add to children link */
370 LWP_LOCK(parent);
371 child->sibling = parent->first_child;
372 parent->first_child = child;
373 child->parent = parent;
374 LWP_UNLOCK(parent);
375
376 LOG_D("%s(parent=%p, child=%p)", __func__, parent, child);
377 /* parent holds reference to child */
378 lwp_ref_inc(parent);
379 /* child holds reference to parent */
380 lwp_ref_inc(child);
381
382 return 0;
383}
384
385/**
386 * @brief Unregister a child process from its parent

Callers 2

lwp_execveFunction · 0.85
_sys_forkFunction · 0.85

Calls 1

lwp_ref_incFunction · 0.85

Tested by

no test coverage detected