summaryrefslogtreecommitdiff
path: root/nuttx/sched/task_start.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-27 15:52:58 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-27 15:52:58 +0000
commit2f2cd79e084223f644af5bb88ff19fd4f739f8b7 (patch)
treedebe53d5a4c8d5a904b5487d632995bbab5a11a2 /nuttx/sched/task_start.c
parent46d5183722a1aac256357f1a054575c6d5ab9a9f (diff)
downloadpx4-nuttx-2f2cd79e084223f644af5bb88ff19fd4f739f8b7.tar.gz
px4-nuttx-2f2cd79e084223f644af5bb88ff19fd4f739f8b7.tar.bz2
px4-nuttx-2f2cd79e084223f644af5bb88ff19fd4f739f8b7.zip
Add a start hook that can be setup to call a function in the context of a new thread before the new threads main() has been called.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5571 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/task_start.c')
-rw-r--r--nuttx/sched/task_start.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/nuttx/sched/task_start.c b/nuttx/sched/task_start.c
index a9cc38dfc..5a32a5dd8 100644
--- a/nuttx/sched/task_start.c
+++ b/nuttx/sched/task_start.c
@@ -94,6 +94,15 @@ void task_start(void)
FAR _TCB *tcb = (FAR _TCB*)g_readytorun.head;
int argc;
+ /* Execute the start hook if one has been registered */
+
+#ifdef CONFIG_SCHED_STARTHOOK
+ if (tcb->starthook)
+ {
+ tcb->starthook(tcb->starthookarg);
+ }
+#endif
+
/* Count how many non-null arguments we are passing */
for (argc = 1; argc <= CONFIG_MAX_TASK_ARGS; argc++)