You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "jasonbu (via GitHub)" <gi...@apache.org> on 2024/10/18 07:54:50 UTC

Re: [PR] nshlib: use spawn to replace the pthread detach in nsh background. [nuttx-apps]

jasonbu commented on code in PR #2522:
URL: https://github.com/apache/nuttx-apps/pull/2522#discussion_r1806048974


##########
nshlib/nsh_parse.c:
##########
@@ -822,43 +657,56 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
           param.sched_priority = priority;
         }
 
-      /* Set up the thread attributes */
-
-      pthread_attr_init(&attr);
-      pthread_attr_setschedpolicy(&attr, SCHED_NSH);
-      pthread_attr_setschedparam(&attr, &param);
-
-      /* Execute the command as a separate thread at the appropriate
-       * priority.
-       */
-
-      ret = pthread_create(&thread, &attr, nsh_child, (pthread_addr_t)args);
-      if (ret != 0)
+      spawn_argv[0] = "nsh_child";

Review Comment:
   use sh -c to do background command. and should be compatible with kernel mode. tested with rv-virt:knsh



-- 
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