xiaoxiang781216 commented on code in PR #22268:
URL: https://github.com/apache/nuttx/pull/22268#discussion_r4690497080


##########
include/nuttx/wqueue.h:
##########
@@ -357,6 +357,34 @@ FAR struct kwork_wqueue_s *work_queue_create(FAR const 
char *name,
                                              FAR void *stack_addr,
                                              int stack_size, int nthreads);
 
+/****************************************************************************
+ * Name: work_queue_create_pthread
+ *
+ * Description:
+ *   Create a custom work queue whose workers are pthreads of the calling
+ *   task, so that the work runs with the file descriptors and the other
+ *   resources of that task.  In the flat build, work_queue_create()
+ *   creates kernel threads instead; in user mode both are the same.
+ *   The workers end with the task: free the queue before the task exits.
+ *   This function must only be called from task context.
+ *
+ * Input Parameters:
+ *   The same as work_queue_create().
+ *
+ * Returned Value:
+ *   The work queue handle returned on success.  Otherwise, NULL
+ *
+ ****************************************************************************/
+
+#if !defined(CONFIG_DISABLE_PTHREAD) && \
+    (defined(CONFIG_BUILD_FLAT) || !defined(__KERNEL__))
+FAR struct kwork_wqueue_s *work_queue_create_pthread(FAR const char *name,

Review Comment:
   let's provide a new work_queue_init which is called from the caller created 
thread context and run the work loop in this context directly



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to