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


##########
sched/signal/sig_initialize.c:
##########
@@ -166,6 +173,13 @@ void nxsig_initialize(void)
   sq_init(&g_sigpendingsignal);
   sq_init(&g_sigpendingirqsignal);
 
+#if CONFIG_SIG_PREALLOC_ACTIONS > 0
+  for (i = 0; i < CONFIG_SIG_PREALLOC_ACTIONS; i++)
+    {
+      sq_addlast((FAR sq_entry_t *)(g_sigactions + i), &g_sigfreeaction);

Review Comment:
   add a function like nxsig_init_pendingsignalblock



##########
sched/signal/sig_initialize.c:
##########
@@ -55,6 +55,10 @@ struct sigpool_s
 
 sq_queue_t  g_sigfreeaction;
 
+#if CONFIG_SIG_PREALLOC_ACTIONS > 0
+sigactq_t   g_sigactions[CONFIG_SIG_PREALLOC_ACTIONS];

Review Comment:
   merge to sigpool_s



##########
sched/signal/sig_action.c:
##########
@@ -102,7 +102,7 @@ static FAR sigactq_t *nxsig_alloc_action(void)
 
   /* Check if we got one. */
 
-  while (!sigact)
+  if (!sigact)

Review Comment:
   keep while loop, there are chance other thread grab the free action after 
line 109 and before line 113



##########
sched/signal/signal.h:
##########
@@ -111,6 +111,15 @@ typedef struct sigq_s sigq_t;
 
 extern sq_queue_t  g_sigfreeaction;
 
+#if CONFIG_SIG_PREALLOC_ACTIONS > 0
+extern sigactq_t   g_sigactions[CONFIG_SIG_PREALLOC_ACTIONS];
+#define IS_PREALLOC_ACTION(x) ( \

Review Comment:
   move to source file



##########
sched/signal/sig_action.c:
##########
@@ -67,12 +67,12 @@ static void nxsig_alloc_actionblock(void)
 
   /* Allocate a block of signal actions */
 
-  sigact = kmm_malloc((sizeof(sigactq_t)) * NUM_SIGNAL_ACTIONS);

Review Comment:
   remove NUM_SIGNAL_ACTIONS



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