* @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. */
| 365 | * increases reference counts for both processes. |
| 366 | */ |
| 367 | rt_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 |
no test coverage detected