(frsh_thread_id_t thread,
bool appscheduled)
{
- int error_code, current_policy, new_policy;
- struct sched_param param;
-
- // set the application-defined scheduler thread
- error_code=pthread_setappscheduler(thread,scheduler_thread_id);
- if (error_code!=0) return error_code;
-
- // switch to the appropriate scheduling policy
- if (appscheduled) {
- new_policy=SCHED_APP;
- } else {
- new_policy=SCHED_FIFO;
- }
- CHK(pthread_getschedparam(thread,¤t_policy,¶m));
- if (((current_policy==SCHED_APP) && (!appscheduled)) ||
- ((current_policy!=SCHED_APP) && appscheduled))
- {
+ int error_code = 0;
+ int current_policy, new_policy;
+ struct sched_param param;
+
+ // switch to the appropriate scheduling policy
+ CHK(pthread_getschedparam(thread,¤t_policy,¶m));
+ if (((current_policy==SCHED_APP) && (!appscheduled)) ||
+ ((current_policy!=SCHED_APP) && appscheduled)) {
+ if (appscheduled) {
+ new_policy=SCHED_APP;
+ // set the application-defined scheduler thread
+ error_code=pthread_setappscheduler(thread,scheduler_thread_id);
+ if (error_code!=0) return error_code;
+ } else {
+ new_policy=SCHED_FIFO;
+ }
error_code=pthread_setschedparam(thread,new_policy,¶m);
- }
- return error_code;
+ }
+ return error_code;
}
/**