SCHED_RR in Classic API?
Joel Sherrill
joel.sherrill at OARcorp.com
Fri May 30 13:10:16 UTC 2003
Kamen Penev wrote:
>
> Joel Sherrill wrote:
>
> > So you can call pthread_XXX on a task created using the Classic API.
> > This would be the easiest way to get this scheduling mode.
> >
> >
>
> After successfully creating a classic task with:
>
> status = rtems_task_create(Task_name[MON_TASKNUM],
> 200,
> RTEMS_MINIMUM_STACK_SIZE *
> MONITOR_STACK_FACTOR,
> RTEMS_PREEMPT|RTEMS_TIMESLICE,
> RTEMS_FLOATING_POINT,
> &Task_id[MON_TASKNUM]);
> assert (RTEMS_SUCCESSFUL == status);
>
> The following fails:
>
> pstatus = pthread_setschedparam(Task_id[MON_TASKNUM],
> SCHED_RR,
> &xSteperPosixParams);
>
> pstatus is ESRCH, which was the result of _Objects_Get searching for the
> classic Task_id in _POSIX_Threads_Information (via _POSIX_Threads_Get)..
>
> What am I missing?
Nothing. It looks to me that the Classic API got this right and there
is a minor bug in the POSIX API. The Classic API calls _Thread_Get()
to translate a task ID into a (Thread_Control *). The POSIX API
should NOT have a _POSIX_Threads_get(). It should be calling
_Thread_Get().
And then it would work.
As a simple solution to verify the idea beind the fix, change the
body of _POSIX_Threads_Get to call _Thread_Get instead of _Objects_Get.
> Kamen
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list