aboutsummaryrefslogtreecommitdiff
path: root/nuttx/include
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
commite96d8f046b6bce6c4e810b302c1cc1cc578bdae3 (patch)
treedebe53d5a4c8d5a904b5487d632995bbab5a11a2 /nuttx/include
parent47b94bafa5045532f239ea57a3610873b1a71368 (diff)
downloadpx4-firmware-e96d8f046b6bce6c4e810b302c1cc1cc578bdae3.tar.gz
px4-firmware-e96d8f046b6bce6c4e810b302c1cc1cc578bdae3.tar.bz2
px4-firmware-e96d8f046b6bce6c4e810b302c1cc1cc578bdae3.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: http://svn.code.sf.net/p/nuttx/code/trunk@5571 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r--nuttx/include/nuttx/sched.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h
index 244455cd4..f8b4eb0dc 100644
--- a/nuttx/include/nuttx/sched.h
+++ b/nuttx/include/nuttx/sched.h
@@ -183,7 +183,13 @@ union entry_u
};
typedef union entry_u entry_t;
-/* These is the types of the functions that are executed with exit() is called
+/* This is the type of the function called at task startup */
+
+#ifdef CONFIG_SCHED_STARTHOOK
+typedef CODE void (*starthook_t)(FAR void *arg);
+#endif
+
+/* These are the types of the functions that are executed with exit() is called
* (if registered via atexit() on on_exit()).
*/
@@ -298,7 +304,10 @@ struct task_group_s
#endif
/* PIC data space and address environments ************************************/
- /* Not yet (see struct dspace_s) */
+ /* Logically the PIC data space belongs here (see struct dspace_s). The
+ * current logic needs review: There are differences in the away that the
+ * life of the PIC data is managed.
+ */
/* File descriptors ***********************************************************/
@@ -354,6 +363,11 @@ struct _TCB
start_t start; /* Thread start function */
entry_t entry; /* Entry Point into the thread */
+#ifdef CONFIG_SCHED_STARTHOOK
+ starthook_t starthook; /* Task startup function */
+ FAR void *starthookarg; /* The argument passed to the function */
+#endif
+
#if defined(CONFIG_SCHED_ATEXIT) && !defined(CONFIG_SCHED_ONEXIT)
# if defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
atexitfunc_t atexitfunc[CONFIG_SCHED_ATEXIT_MAX];
@@ -516,6 +530,12 @@ FAR struct streamlist *sched_getstreams(void);
FAR struct socketlist *sched_getsockets(void);
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
+/* Setup up a start hook */
+
+#ifdef CONFIG_SCHED_STARTHOOK
+void task_starthook(FAR _TCB *tcb, starthook_t starthook, FAR void *arg);
+#endif
+
/* Internal vfork support.The overall sequence is:
*
* 1) User code calls vfork(). vfork() is provided in architecture-specific