]> rtime.felk.cvut.cz Git - frescor/fosa.git/commitdiff
addactivate cannot be called from new thread, added EREJECT constant and assert function
authorsangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Wed, 13 Jun 2007 15:22:28 +0000 (15:22 +0000)
committersangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Wed, 13 Jun 2007 15:22:28 +0000 (15:22 +0000)
git-svn-id: http://www.frescor.org/private/svn/frescor/fosa/trunk@463 35b4ef3e-fd22-0410-ab77-dab3279adceb

src_marte/test_fosa_ads.c

index 58d3c71b5d3cb6868ee9635c614a8489ebc4b9a2..152be8a2b84547dbff619cc34b261330bd221121 100644 (file)
@@ -234,13 +234,13 @@ int main () {
     // create thread 3 - should be rejected
     err = fosa_thread_create (&tid3, &th_attr, thread_code, (void *)3);
     printf("creating thread 3 (rejected=%d), err=%d\n",
-            (err == -4), err);
+            (err == FOSA_EREJECT), err);
 
     err = frsh_thread_attr_destroy(&th_attr);
     printf("thread attributes object destroyed, err=%d\n",err);
     assert(err == 0);
 
-    sleep (4);
+    sleep (5);
 
     //////////////////////////////////////////////////////////////
     //  2c) Change appsched params
@@ -318,10 +318,11 @@ int main () {
 
 static void *thread_code (void * arg)
 {
-    struct timespec ts = {5, 0};
+    struct timespec ts = {2, 0};
     int err, i;
     char whoami[] = "who am i?";
     int reply;
+    size_t reply_size;
 
     printf("Thread %d starts\n", (int)arg);
     for (i=1;i<50;i++) {
@@ -340,7 +341,7 @@ static void *thread_code (void * arg)
         assert(err == 0);
 
         err = fosa_ads_invoke_withdata
-                (whoami, sizeof(whoami), (void *)&reply, NULL);
+                (whoami, sizeof(whoami), (void *)&reply, &reply_size);
         printf("who am I, correct?: %d, err=%d\n", reply == (int)arg, err);
         assert(err == 0);
 
@@ -382,6 +383,7 @@ static void frsh_callback_new_thread
     unsigned int i, index;
     frsh_sched_data_t *frsh = (frsh_sched_data_t *)sched_data;
     appsched_params_t params;
+    size_t size;
 
     printf ("CALLBACK: %s \n", __func__);
 
@@ -397,15 +399,13 @@ static void frsh_callback_new_thread
         err = fosa_adsactions_add_reject(actions, thread);
         assert(err == 0);
     } else {
-        // Get the priority for the new thread (NULL is possible?)
-        err = fosa_ads_get_appsched_params(thread, (void *)&params, NULL);
+        // Get the priority for the new thread
+        size = sizeof(params);
+        err = fosa_ads_get_appsched_params(thread, (void *)&params, &size);
         assert(err == 0);
 
         frsh->array_prio[index] = params.prio;
         frsh->array_status[index] = 1;
-
-        err = fosa_adsactions_add_activate(actions, thread, params.prio);
-        assert(err == 0);
     }
 }