]> rtime.felk.cvut.cz Git - frescor/fosa.git/blobdiff - src_partikle/fosa_app_def_sched.c
FOSA-PaRTiKle: minor fixes
[frescor/fosa.git] / src_partikle / fosa_app_def_sched.c
index 057e65606dc2755144e2543cd489caf891c451b2..c47296e7a9d3bdf19d9a554c96d03ec7c0a832a2 100644 (file)
@@ -99,9 +99,6 @@ void *fosa_scheduler_main (void * args)
        struct posix_appsched_event event;
        struct timespec current_time;
        posix_appsched_eventset_t accepted_events;
-//     bool active;
-       
-       printf ("SCHEDULER thread=0x%lx\n\n", (unsigned long) pthread_self ());
        
        // accept events which have a callback associated
        posix_appsched_fillset (&accepted_events);
@@ -146,14 +143,15 @@ void *fosa_scheduler_main (void * args)
        clear_actions (&actions);
 
        while (1) {     // scheduler loop
-//             printf ("ACTIONS: timeout(0x%x), handled_signals=0x%x\n", actions.timeout_ptr, fosa_handled_signals.sig);
                if (posix_appsched_execute_actions(&(actions.actions), &fosa_handled_signals, actions.timeout_ptr,
                    &current_time, &event))
-                       perror ("posix_appsched_execute_actions");
+               {
+                 fosa_scheduler_ops.appsched_error 
+                     (fosa_scheduler_data, 0x0, FOSA_ADS_THREAD_NOT_ATTACHED, &actions);
+                 continue;
+               }
                
-//             printf ("\nReceived event=%d. current_time={%ld,%ld}\n", event.event_code, current_time.tv_sec, current_time.tv_nsec);
                clear_actions (&actions);
-               
                switch (event.event_code) {
                        case POSIX_APPSCHED_NEW:
                                fosa_scheduler_ops.new_thread
@@ -164,12 +162,7 @@ void *fosa_scheduler_main (void * args)
 
                                if (!actions.rejected) {
                                        
-/*                                     active = actions.activated;
-                                       int suspend = actions.suspended; */
-// #ifndef CONFIG_URGENCY  
                                        clear_actions (&actions);
-//                                         printf ("NEW: activate (%d), suspend (%d)\n", actions.activated, actions.suspended);
-// // #endif
   
                                        // alloc memory for reply info of 'fosa_ads_invoke_with_data ()'
                                        struct reply_info *reply_mem = malloc (sizeof (struct reply_info));
@@ -256,7 +249,7 @@ void *fosa_scheduler_main (void * args)
                                                 &current_time);
                                break;
 
-                       case POSIX_APPSCHED_ERROR:
+                       case POSIX_APPSCHED_ERROR: // Implemented using the usual error handling mechanism
                                fosa_scheduler_ops.appsched_error 
                                        (fosa_scheduler_data, 
                                         event.thread, 
@@ -281,10 +274,6 @@ int fosa_ads_scheduler_create
        pthread_attr_t attr;
        struct sched_param sp;
        
-       
-       printf ("\nMAIN thread=0x%lx\n\n", (unsigned long)pthread_self ());
-       
-       
        if (!scheduler_ops)
                return EINVAL;
        fosa_scheduler_ops = *scheduler_ops;
@@ -469,7 +458,7 @@ int fosa_adsactions_add_activate
        pthread_getschedparam (thread, &policy, &sp);
        fosa_thread_get_prio (thread, &fosaprio);
        sp.sched_priority =  fosa2prtk (fosaprio, urgency);
-       printf ("policy=%d, prio=%d, urg=%d, new_prio=%d\n", policy);
+//     printf ("policy=%d, prio=%d, urg=%d, new_prio=%d\n", policy);
        pthread_setschedparam (thread, policy, &sp);
 #endif
        return posix_appsched_actions_addactivate (&(sched_actions -> actions), thread);