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

Function __exit_files

components/lwp/lwp_pid.c:376–392  ·  view source on GitHub ↗

* @brief Close all open files for the given LWP * * @param[in] lwp The LWP whose files should be closed * * @note This function iterates through all file descriptors in the LWP's file * descriptor table, closing each open file. It is typically called when * an LWP is being destroyed or when the LWP is switching to a new thread. */

Source from the content-addressed store, hash-verified

374 * an LWP is being destroyed or when the LWP is switching to a new thread.
375 */
376static void __exit_files(struct rt_lwp *lwp)
377{
378 int fd = lwp->fdt.maxfd - 1;
379
380 while (fd >= 0)
381 {
382 struct dfs_file *d;
383
384 d = lwp->fdt.fds[fd];
385 if (d)
386 {
387 dfs_file_close(d);
388 fdt_fd_release(&lwp->fdt, fd);
389 }
390 fd--;
391 }
392}
393
394/**
395 * @brief Initialize the user object lock for a lightweight process

Callers 1

_resr_cleanupFunction · 0.85

Calls 2

dfs_file_closeFunction · 0.50
fdt_fd_releaseFunction · 0.50

Tested by

no test coverage detected