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);
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,
¤t_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
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));
¤t_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,
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;
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);