Module: xenomai-3
Branch: next
Commit: 4f446a6eb7abd8b304944bc342507b7feb35acd3
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4f446a6eb7abd8b304944bc342507b7feb35acd3

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Jun 19 14:47:48 2015 +0200

copperplate/heapobj: give unshadowed main thread a large wait_union

---

 lib/copperplate/threadobj.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index 1b98fbf..88bb59e 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -44,6 +44,11 @@ union copperplate_wait_union {
        struct eventobj_wait_struct eventobj_wait;
 };
 
+union main_wait_union {
+       union copperplate_wait_union copperplate_wait;
+       char untyped_wait[1024];
+};
+
 static void finalize_thread(void *p);
 
 static void set_global_priority(struct threadobj *thobj, int policy,
@@ -1697,10 +1702,15 @@ static inline int main_overlay(void)
        /*
         * Make the main() context a basic yet complete thread object,
         * so that it may use any services which require the caller to
-        * have a Copperplate TCB (e.g. all blocking services).
+        * have a Copperplate TCB (e.g. all blocking services). We
+        * allocate a wait union which should be sufficient for
+        * calling any blocking service from any high-level API from
+        * an unshadowed main thread. APIs might have other reasons
+        * not to allow such call though, in which case they should
+        * check explicitly for those conditions.
         */
        tcb = __threadobj_alloc(sizeof(*tcb),
-                               sizeof(union copperplate_wait_union),
+                               sizeof(union main_wait_union),
                                0);
        if (tcb == NULL)
                panic("failed to allocate main tcb");


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to