diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 953f5eea103..330429e3b47 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -441,6 +441,11 @@ Other memory: * added pthread_barrierattr_*() APIs * added pthread_barrier_init(), pthread_barrier_destroy(), and pthread_barrier_wait(); + * Added protection so that errno cannot be modified from + interrupt handling. + * sched_setparam(), sched_setscheduler() now correctly set + errno; pthread_setscheduler() now returns the correct errno. + * Added pthread_setschedprio(). * Started m68322 diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html index 883da65c3d8..7ebb2c13bb8 100644 --- a/Documentation/NuttxUserGuide.html +++ b/Documentation/NuttxUserGuide.html @@ -93,11 +93,11 @@ paragraphs.

Tasks. - NuttX is a flat address OS. As such it does not support "processes" + NuttX is a flat address OS. As such it does not support processes in the way that, say, Linux does. NuttX only supports simple threads running within the same address space. - However, the programming model makes a distinction between "tasks" - and pthreads: + However, the programming model makes a distinction between tasks + and pthreads:

2.2.1 sched_setparam

- -

-Function Prototype: -

+

+ Function Prototype: +

     #include <sched.h>
-    int sched_setparam( pid_t pid, const struct sched_param *param );
-
+ int sched_setparam(pid_t pid, const struct sched_param *param); +
+

+ Description: + This function sets the priority of the task specified by pid input parameter. +

+

+ NOTE: Setting a task's priority to the same value has the similar + effect to sched_yield(): The task will be moved to after all + other tasks with the same priority. +

+

+ Input Parameters: +

+ +

+ Returned Values: + On success, sched_setparam() returns 0 (OK). + On error, -1 (ERROR) is returned, and errno is set appropriately. +

+ +

+ Assumptions/Limitations: +

+

+ POSIX Compatibility: + Comparable to the POSIX interface of the same name. + Differences from the full POSIX implementation include: +

+

2.2.2 sched_getparam

@@ -3121,6 +3137,16 @@ be sent.

2.9 Pthread Interfaces

+

+ NuttX does not support processes in the way that, say, Linux does. + NuttX only supports simple threads or tasks running within the same address space. + For the most part, threads and tasks are interchangeable and differ primarily + only in such things as the inheritance of file descriptors. + Basically, threads are initialized and uninitialized differently and share a + few more resources than tasks. +

+ The following pthread interfaces are supported in some form by NuttX: +

+

+ No support for the ollowing pthread interfaces is provided by NuttX: +

+

2.9.1 pthread_attr_init

@@ -3825,68 +3909,162 @@ returned to indicate the error: interface of the same name.

2.9.20 pthread_getschedparam

-

-Function Prototype: -

-

+

+ Function Prototype: +

+
     #include <pthread.h>
     int pthread_getschedparam(pthread_t thread, int *policy,
-				 struct sched_param *param);
-
-

-Description: -

-Input Parameters: -

-

    -
  • param.
  • -
-

-Returned Values: -

-If successful, the pthread_getschedparam() function will return -zero (OK). Otherwise, an error number will be -returned to indicate the error: -

-

    -
  • Exxx.
  • -
-Assumptions/Limitations: -

-POSIX Compatibility: Comparable to the POSIX -interface of the same name. + struct sched_param *param); +

+

+ Description: + The pthread_getschedparam() functions will get the + scheduling policy and parameters of threads. + For SCHED_FIFO and SCHED_RR, the only + required member of the sched_param structure is the + priority sched_priority. +

+

+ The pthread_getschedparam() function will retrieve the + scheduling policy and scheduling parameters for the thread whose thread + ID is given by thread and will store those values in + policy and param, respectively. + The priority value returned from pthread_getschedparam() + will be the value specified by the most recent pthread_setschedparam(), + pthread_setschedprio(), or pthread_create() call + affecting the target thread. + It will not reflect any temporary adjustments to its priority (such as might + result of any priority inheritance, for example). +

+

+ The policy parameter may have the value SCHED_FIFO or SCHED_RR + (SCHED_OTHER and SCHED_SPORADIC, in particular, are not supported). + The SCHED_FIFO and SCHED_RR policies will have a single + scheduling parameter, sched_priority. +

+

+ Input Parameters: +

+
    +
  • + thread. + The ID of thread whose scheduling parameters will be queried. +
  • +
  • + policy. + The location to store the thread's scheduling policy. +
  • +
  • + param. + The location to store the thread's priority. +
  • +
+

+ Returned Values: + 0 (OK) if successful. + Otherwise, the error code ESRCH if the value specified by + thread does not refer to an existing thread. +

+

+ Assumptions/Limitations: +

+

+ POSIX Compatibility: + Comparable to the POSIX interface of the same name. +

2.9.21 pthread_setschedparam

-

-Function Prototype: -

-

+

+ Function Prototype: +

+
     #include <pthread.h>
     int pthread_setschedparam(pthread_t thread, int policy,
-				 const struct sched_param *param);
-
-

-Description: -

-Input Parameters: -

-

    -
  • param.
  • -
-

-Returned Values: -

-If successful, the pthread_setschedparam() function will return -zero (OK). Otherwise, an error number will be -returned to indicate the error: -

-

    -
  • Exxx.
  • -
-Assumptions/Limitations: -

-POSIX Compatibility: Comparable to the POSIX -interface of the same name. + const struct sched_param *param); +

+

+ Description: + The pthread_setschedparam() functions will set the scheduling policy + and parameters of threads. + For SCHED_FIFO and SCHED_RR, the only required member + of the sched_param structure is the priority sched_priority. +

+

+ The pthread_setschedparam() function will set the scheduling policy + and associated scheduling parameters for the thread whose thread ID is given by + thread to the policy and associated parameters provided in + policy and param, respectively. +

+

+ The policy parameter may have the value SCHED_FIFO or SCHED_RR. + (SCHED_OTHER and SCHED_SPORADIC, in particular, are not supported). + The SCHED_FIFO and SCHED_RR policies will have a single + scheduling parameter, sched_priority. +

+

+ If the pthread_setschedparam() function fails, the scheduling + parameters will not be changed for the target thread. +

+

+ Input Parameters: +

+
    +
  • + thread. + The ID of thread whose scheduling parameters will be modified. +
  • +
  • + policy. + The new scheduling policy of the thread. + Either SCHED_FIFO or SCHED_RR. + SCHED_OTHER and SCHED_SPORADIC are not supported. +
  • +
  • + param. + The location to store the thread's priority. +
  • +
+

+ Returned Values: +

+

+ If successful, the pthread_setschedparam() function will return + zero (OK). Otherwise, an error number will be + returned to indicate the error: +

+
    +
  • + EINVAL. + The value specified by policy or one of the scheduling parameters + associated with the scheduling policy policy is invalid. +
  • +
  • + ENOTSUP. + An attempt was made to set the policy or scheduling parameters to an unsupported + value (SCHED_OTHER and SCHED_SPORADIC in particular are + not supported) +
  • +
  • + EPERM. + The caller does not have the appropriate permission to set either the scheduling + parameters or the scheduling policy of the specified thread. + Or, the implementation does not allow the application to modify one of the + parameters to the value specified. + +
  • +
  • + ESRCH. + The value specified by thread does not refer to a existing thread. +
  • +
+

+ Assumptions/Limitations: +

+

+ POSIX Compatibility: + Comparable to the POSIX interface of the same name. +

2.9.22 pthread_key_create