[pok-devel] [13] * Update the examples, include all necessary code

[ Thread Index | Date Index | More lists.tuxfamily.org/pok-devel Archives ]


Revision: 13
Author:   julien
Date:     2011-08-13 08:53:45 +0200 (Sat, 13 Aug 2011)
Log Message:
-----------
 * Update the examples, include all necessary code
   to be executed correctly.

Modified Paths:
--------------
    trunk/examples/semaphores/kernel/deployment.h
    trunk/examples/semaphores/pr1/deployment.h
    trunk/examples/semaphores/pr1/main.c
    trunk/examples/semaphores/pr2/deployment.h
    trunk/examples/semaphores/pr2/main.c

Modified: trunk/examples/semaphores/kernel/deployment.h
===================================================================
--- trunk/examples/semaphores/kernel/deployment.h	2011-08-13 06:40:24 UTC (rev 12)
+++ trunk/examples/semaphores/kernel/deployment.h	2011-08-13 06:53:45 UTC (rev 13)
@@ -26,7 +26,7 @@
 #define POK_NEEDS_CONSOLE      1
 #define POK_NEEDS_LOCKOBJECTS  1
 
-#define POK_CONFIG_NB_THREADS       5
+#define POK_CONFIG_NB_THREADS       7
 #define POK_CONFIG_NB_LOCKOBJECTS       1
 #define POK_CONFIG_NB_PARTITIONS    2
 
@@ -38,6 +38,8 @@
 #define POK_CONFIG_SCHEDULING_SLOTS_ALLOCATION {0,1,0,1}
 #define POK_CONFIG_SCHEDULING_NBSLOTS 4
 
+#define POK_NEEDS_THREAD_SUSPEND 1
+#define POK_NEEDS_THREAD_SLEEP 1
 
 #define POK_CONFIG_PARTITIONS_NTHREADS  {3,2}
 #define POK_CONFIG_PARTITIONS_NLOCKOBJECTS  {1,0}

Modified: trunk/examples/semaphores/pr1/deployment.h
===================================================================
--- trunk/examples/semaphores/pr1/deployment.h	2011-08-13 06:40:24 UTC (rev 12)
+++ trunk/examples/semaphores/pr1/deployment.h	2011-08-13 06:53:45 UTC (rev 13)
@@ -24,6 +24,8 @@
 #define POK_NEEDS_DEBUG 1
 #define POK_NEEDS_CONSOLE 1
 
-#define POK_NEEDS_SEMAPHORES
+#define POK_NEEDS_SEMAPHORES 1
 
+#define POK_NEEDS_LIBC_STDLIB 1
+
 #endif

Modified: trunk/examples/semaphores/pr1/main.c
===================================================================
--- trunk/examples/semaphores/pr1/main.c	2011-08-13 06:40:24 UTC (rev 12)
+++ trunk/examples/semaphores/pr1/main.c	2011-08-13 06:53:45 UTC (rev 13)
@@ -17,6 +17,7 @@
 
 #include <libc/stdio.h>
 #include <core/thread.h>
+#include <core/partition.h>
 #include <core/semaphore.h>
 #include <types.h>
 #include "activity.h"
@@ -30,18 +31,21 @@
   pok_thread_attr_t     tattr;
 
   ret = pok_sem_create(&sid , 0, 50, POK_SEMAPHORE_DISCIPLINE_FIFO);
-  printf("pok_sem_create return=%d, mid=%d\n", ret, sid);
+  printf("[P1] pok_sem_create return=%d, mid=%d\n", ret, sid);
 
   tattr.priority = 42;
   tattr.entry = pinger_job;
 
   ret = pok_thread_create(&tid , &tattr);
+  printf("[P1] pok_thread_create (1) return=%d\n", ret);
 
   tattr.priority = 42;
   tattr.entry = pinger_job2;
 
   ret = pok_thread_create(&tid , &tattr);
+  printf("[P1] pok_thread_create (2) return=%d\n", ret);
 
+  pok_partition_set_mode (POK_PARTITION_MODE_NORMAL);
   pok_thread_wait_infinite ();
 
    return (0);

Modified: trunk/examples/semaphores/pr2/deployment.h
===================================================================
--- trunk/examples/semaphores/pr2/deployment.h	2011-08-13 06:40:24 UTC (rev 12)
+++ trunk/examples/semaphores/pr2/deployment.h	2011-08-13 06:53:45 UTC (rev 13)
@@ -23,4 +23,6 @@
 
 #define POK_CONFIG_NB_THREADS 1
 
+#define POK_NEEDS_LIBC_STDLIB 1
+
 #endif

Modified: trunk/examples/semaphores/pr2/main.c
===================================================================
--- trunk/examples/semaphores/pr2/main.c	2011-08-13 06:40:24 UTC (rev 12)
+++ trunk/examples/semaphores/pr2/main.c	2011-08-13 06:53:45 UTC (rev 13)
@@ -16,6 +16,7 @@
 
 
 #include <core/thread.h>
+#include <core/partition.h>
 #include <types.h>
 #include "activity.h"
 
@@ -30,8 +31,9 @@
   tattr.entry = pinger_job;
 
   ret = pok_thread_create(&tid , &tattr);
-  printf ("thread create returns=%d\n", ret);
+  printf ("[P2] thread create returns=%d\n", ret);
 
+  pok_partition_set_mode (POK_PARTITION_MODE_NORMAL);
   pok_thread_wait_infinite ();
 
   return (1);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/