Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
c128edff
Commit
c128edff
authored
12 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
Don't flush streams until the final thread of a group exits
parent
a9f46153
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sched/task_exithook.c
+32
-10
32 additions, 10 deletions
sched/task_exithook.c
with
32 additions
and
10 deletions
sched/task_exithook.c
+
32
−
10
View file @
c128edff
...
...
@@ -540,12 +540,40 @@ static inline void task_exitwakeup(FAR struct tcb_s *tcb, int status)
# define task_exitwakeup(tcb, status)
#endif
/****************************************************************************
* Name: task_flushstreams
*
* Description:
* Flush all streams when the final thread of a group exits.
*
****************************************************************************/
#if CONFIG_NFILE_STREAMS > 0
static
inline
void
task_flushstreams
(
FAR
struct
tcb_s
*
tcb
)
{
FAR
struct
task_group_s
*
group
=
tcb
->
group
;
/* Have we already left the group? Are we the last thread in the group? */
if
(
group
&&
group
->
tg_nmembers
==
1
)
{
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
(
void
)
lib_flushall
(
tcb
->
group
->
tg_streamlist
);
#else
(
void
)
lib_flushall
(
&
tcb
->
group
->
tg_streamlist
);
#endif
}
}
#else
# define task_flushstreams(tcb)
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: task_hook
* Name: task_
exit
hook
*
* Description:
* This function implements some of the internal logic of exit() and
...
...
@@ -604,17 +632,11 @@ void task_exithook(FAR struct tcb_s *tcb, int status)
task_exitwakeup
(
tcb
,
status
);
/*
Flush all streams (File descriptors will be closed when
* the TCB is deallocated).
/*
If this is the last thread in the group, then flush all streams (File
*
descriptors will be closed when
the TCB is deallocated).
*/
#if CONFIG_NFILE_STREAMS > 0
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
(
void
)
lib_flushall
(
tcb
->
group
->
tg_streamlist
);
#else
(
void
)
lib_flushall
(
&
tcb
->
group
->
tg_streamlist
);
#endif
#endif
task_flushstreams
(
tcb
);
/* Leave the task group. Perhaps discarding any un-reaped child
* status (no zombies here!)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment