You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/17 04:38:35 UTC

[GitHub] [incubator-nuttx] anchao opened a new pull request #5524: mm/iob: add support of alloc with timeout iob_timedalloc()

anchao opened a new pull request #5524:
URL: https://github.com/apache/incubator-nuttx/pull/5524


   ## Summary
   
   mm/iob: add support of alloc with timeout iob_timedalloc() 
   
   ## Impact
   
   N/A
   
   ## Testing
   
   ci check


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on a change in pull request #5524: mm/iob: add support of alloc with timeout iob_timedalloc()

Posted by GitBox <gi...@apache.org>.
anchao commented on a change in pull request #5524:
URL: https://github.com/apache/incubator-nuttx/pull/5524#discussion_r808860428



##########
File path: include/nuttx/mm/iob.h
##########
@@ -233,6 +233,23 @@ struct iob_userstats_s
 
 void iob_initialize(void);
 
+/****************************************************************************
+ * Name: iob_timedalloc
+ *
+ * Description:
+ *  Allocate an I/O buffer by taking the buffer at the head of the free list.
+ *  This wait will be terminated when the specified timeout expires.
+ *
+ * Input Parameters:
+ *   throttled  - An indication of the IOB allocation is "throttled"
+ *   timeout    - Timeout value in microseconds.

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5524: mm/iob: add support of alloc with timeout iob_timedalloc()

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5524:
URL: https://github.com/apache/incubator-nuttx/pull/5524#discussion_r808797207



##########
File path: mm/iob/iob_alloc.c
##########
@@ -130,7 +130,27 @@ static FAR struct iob_s *iob_allocwait(bool throttled,
        * list.
        */
 
-      ret = nxsem_wait_uninterruptible(sem);
+      if (timeout == UINT_MAX)
+        {
+          ret = nxsem_wait_uninterruptible(sem);
+        }
+      else
+        {
+          struct timespec abstime;
+
+          DEBUGVERIFY(clock_gettime(CLOCK_REALTIME, &abstime));

Review comment:
       ```suggestion
             DEBUGVERIFY(clock_systime_timespec(&abstime) == 0);
   ```

##########
File path: mm/iob/iob_alloc.c
##########
@@ -93,7 +93,7 @@ static FAR struct iob_s *iob_alloc_committed(enum iob_user_e consumerid)
  *
  ****************************************************************************/
 
-static FAR struct iob_s *iob_allocwait(bool throttled,
+static FAR struct iob_s *iob_allocwait(bool throttled, unsigned int timeout,

Review comment:
       should me somehow make a hint that `timeout` has ms resolution?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on a change in pull request #5524: mm/iob: add support of alloc with timeout iob_timedalloc()

Posted by GitBox <gi...@apache.org>.
anchao commented on a change in pull request #5524:
URL: https://github.com/apache/incubator-nuttx/pull/5524#discussion_r808841190



##########
File path: mm/iob/iob_alloc.c
##########
@@ -130,7 +130,27 @@ static FAR struct iob_s *iob_allocwait(bool throttled,
        * list.
        */
 
-      ret = nxsem_wait_uninterruptible(sem);
+      if (timeout == UINT_MAX)
+        {
+          ret = nxsem_wait_uninterruptible(sem);
+        }
+      else
+        {
+          struct timespec abstime;
+
+          DEBUGVERIFY(clock_gettime(CLOCK_REALTIME, &abstime));

Review comment:
       need absolute time here:
   https://github.com/apache/incubator-nuttx/blob/master/include/nuttx/semaphore.h#L546




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis merged pull request #5524: mm/iob: add support of alloc with timeout iob_timedalloc()

Posted by GitBox <gi...@apache.org>.
acassis merged pull request #5524:
URL: https://github.com/apache/incubator-nuttx/pull/5524


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5524: mm/iob: add support of alloc with timeout iob_timedalloc()

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5524:
URL: https://github.com/apache/incubator-nuttx/pull/5524#discussion_r808849414



##########
File path: include/nuttx/mm/iob.h
##########
@@ -233,6 +233,23 @@ struct iob_userstats_s
 
 void iob_initialize(void);
 
+/****************************************************************************
+ * Name: iob_timedalloc
+ *
+ * Description:
+ *  Allocate an I/O buffer by taking the buffer at the head of the free list.
+ *  This wait will be terminated when the specified timeout expires.
+ *
+ * Input Parameters:
+ *   throttled  - An indication of the IOB allocation is "throttled"
+ *   timeout    - Timeout value in microseconds.

Review comment:
       ```suggestion
    *   timeout    - Timeout value in milliseconds.
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] anchao commented on a change in pull request #5524: mm/iob: add support of alloc with timeout iob_timedalloc()

Posted by GitBox <gi...@apache.org>.
anchao commented on a change in pull request #5524:
URL: https://github.com/apache/incubator-nuttx/pull/5524#discussion_r808845917



##########
File path: mm/iob/iob_alloc.c
##########
@@ -93,7 +93,7 @@ static FAR struct iob_s *iob_alloc_committed(enum iob_user_e consumerid)
  *
  ****************************************************************************/
 
-static FAR struct iob_s *iob_allocwait(bool throttled,
+static FAR struct iob_s *iob_allocwait(bool throttled, unsigned int timeout,

Review comment:
       OK, I will add describe of timeout parameter in code comment.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org