diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 087fd48a7bc..fcdb9b1d124 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -454,6 +454,11 @@ Other memory: * mq_receive and mq_send now return errno's appropriately * mq_receive and mq_send are now correctly awakened by signals. + * Fixed an unmatched sched_lock/unlock pair in task_delete(). + * sched_lock must be called in _exit() because operation of + task_delete() can cause pending tasks to be merged and a + context switch to occur. + * Added mq_timedreceive() and mq_timedsend() * Started m68322 diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html index d706c60c62d..3fd59357c3b 100644 --- a/Documentation/NuttxUserGuide.html +++ b/Documentation/NuttxUserGuide.html @@ -1021,10 +1021,12 @@ on this thread of execution.
  • 2.4.2 mq_close
  • 2.4.3 mq_unlink
  • 2.4.4 mq_send
  • -
  • 2.4.5 mq_receive
  • -
  • 2.4.6 mq_notify
  • -
  • 2.4.7 mq_setattr
  • -
  • 2.4.8 mq_getattr
  • +
  • 2.4.5 mq_timedsend
  • +
  • 2.4.6 mq_receive
  • +
  • 2.4.7 mq_timedreceive
  • +
  • 2.4.8 mq_notify
  • +
  • 2.4.9 mq_setattr
  • +
  • 2.4.10 mq_getattr
  • 2.4.1 mq_open

    @@ -1171,7 +1173,6 @@ closed. interface of the same name.

    2.4.4 mq_send

    -

    Function Prototype:

    @@ -1246,13 +1247,96 @@ interface of the same name. Comparable to the POSIX interface of the same name.

    +

    mq_timedsend

    +Function Prototype: +

    +
    +    #include <mqueue.h>
    +    int mq_timedsend(mqd_t mqdes, const char *msg, size_t msglen, int prio,
    +                     const struct timespec *abstime);
    +
    +

    +Description: + This function adds the specified message, msg, + to the message queue, mqdes. + The msglen parameter specifies the length of the message in bytes pointed to by msg. + This length must not exceed the maximum message length from the mq_getattr(). +

    +

    + If the message queue is not full, mq_timedsend() will place the msg + in the message queue at the position indicated by the prio argument. + Messages with higher priority will be inserted before lower priority messages + The value of prio must not exceed MQ_PRIO_MAX. +

    +

    + If the specified message queue is full and O_NONBLOCK is not + set in the message queue, then mq_send() will block until space + becomes available to the queue the message or until a timeout occurs. +

    +

    + mq_timedsend() behaves just like mq_send(), except + that if the queue is full and the O_NONBLOCK flag is not enabled + for the message queue description, then abstime points to a + structure which specifies a ceiling on the time for which the call will block. + This ceiling is an absolute timeout in seconds and nanoseconds since the + Epoch (midnight on the morning of 1 January 1970). +

    +

    + If the message queue is full, and the timeout has already expired by the time + of the call, mq_timedsend() returns immediately. +

    +

    + Input Parameters: +

    + +

    + Returned Values: + On success, mq_send() returns 0 (OK); + on error, -1 (ERROR) is returned, with errno set + to indicate the error: +

    + +

    + Assumptions/Limitations: +

    +

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

    +

    2.4.5 mq_receive

    Function Prototype:

         #include <mqueue.h>
    -    int mq_receive(mqd_t mqdes, void *msg, size_t msglen, int *prio);
    +    ssize_t mq_receive(mqd_t mqdes, void *msg, size_t msglen, int *prio);
     

    Description: @@ -1316,7 +1400,92 @@ interface of the same name. Comparable to the POSIX interface of the same name.

    -

    2.4.6 mq_notify

    +

    2.4.6 mq_timedreceive

    +

    + Function Prototype: +

    +
    +    #include <mqueue.h>
    +    ssize_t mq_timedreceive(mqd_t mqdes, void *msg, size_t msglen,
    +                            int *prio, const struct timespec *abstime);
    +
    +

    + Description: + This function receives the oldest of the highest priority messages from the message + queue specified by mqdes. + If the size of the buffer in bytes, msgLen, is less than the + mq_msgsize attribute of the message queue, mq_timedreceive() will + return an error. + Otherwise, the selected message is removed from the queue and copied to msg. +

    +

    + If the message queue is empty and O_NONBLOCK was not set, mq_timedreceive() + will block until a message is added to the message queue (or until a timeout occurs). + If more than one task is waiting to receive a message, only the task with the highest + priority that has waited the longest will be unblocked. +

    +

    + mq_timedreceive() behaves just like mq_receive(), except + that if the queue is empty and the O_NONBLOCK flag is not enabled + for the message queue description, then abstime points to a structure + which specifies a ceiling on the time for which the call will block. + This ceiling is an absolute timeout in seconds and nanoseconds since the Epoch + (midnight on the morning of 1 January 1970). +

    +

    + If no message is available, and the timeout has already expired by the time of + the call, mq_timedreceive() returns immediately. +

    +

    + Input Parameters: +

    +
      +
    • mqdes. Message Queue Descriptor.
    • +
    • msg. Buffer to receive the message.
    • +
    • msglen. Size of the buffer in bytes.
    • +
    • prio. If not NULL, the location to store message priority. +
    • abstime. The absolute time to wait until a timeout is declared. +
    +

    + Returned Values:. + One success, the length of the selected message in bytes is returned. + On failure, -1 (ERROR) is returned and the errno is set appropriately: +

    +
      +
    • + EAGAIN: + The queue was empty and the O_NONBLOCK flag was set for the message queue description referred to by mqdes. +
    • +
    • + EPERM: + Message queue opened not opened for reading. +
    • +
    • + EMSGSIZE: + msglen was less than the maxmsgsize attribute of the message queue. +
    • +
    • + EINTR: + The call was interrupted by a signal handler. +
    • +
    • + EINVAL: + Invalid msg or mqdes or abstime +
    • +
    • + ETIMEDOUT: + The call timed out before a message could be transferred. +
    • +
    +

    + Assumptions/Limitations: +

    +

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

    + +

    2.4.7 mq_notify

    Function Prototype: @@ -1372,7 +1541,7 @@ appropriate mq_receive() ... The resulting behavior is as if the message queue remains empty, and no notification shall be sent." -

    2.4.7 mq_setattr

    +

    2.4.8 mq_setattr

    Function Prototype: @@ -1411,7 +1580,7 @@ would have been returned by mq_getattr()). POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.4.8 mq_getattr

    +

    2.4.9 mq_getattr

    Function Prototype: @@ -5641,6 +5810,8 @@ notify a task when a message is available on a queue.

  • mq_receive
  • mq_send
  • mq_setattr
  • +
  • mq_timedreceive
  • +
  • mq_timedsend
  • mq_unlink
  • OS Interfaces
  • Pthread Interfaces