xiaoxiang781216 commented on code in PR #15415:
URL: https://github.com/apache/nuttx/pull/15415#discussion_r1903279432
##########
sched/mqueue/mqueue.h:
##########
@@ -101,6 +101,8 @@ EXTERN struct list_node g_msgfree;
EXTERN struct list_node g_msgfreeirq;
+EXTERN spinlock_t g_msgfree_lock;
Review Comment:
need include nuttx/spinlock.h
##########
sched/clock/clock_internal.h:
##########
@@ -0,0 +1,72 @@
+/****************************************************************************
+ * sched/clock/clock_internal.h
Review Comment:
why not put into sched/clock/clock.h
##########
sched/clock/clock_settime.c:
##########
@@ -71,16 +73,17 @@ void nxclock_settime(clockid_t clock_id, FAR const struct
timespec *tp)
* possible.
*/
- flags = enter_critical_section();
+ flags = spin_lock_irqsave(&g_basetime_lock);
/* Get the elapsed time since power up (in milliseconds). This is a
* bias value that we need to use to correct the base time.
*/
- clock_systime_timespec(&bias);
Review Comment:
keep as before
##########
sched/timer/timer.h:
##########
@@ -85,6 +86,8 @@ extern volatile sq_queue_t g_freetimers;
extern volatile sq_queue_t g_alloctimers;
+extern volatile spinlock_t g_freetimers_lock;
Review Comment:
```suggestion
extern spinlock_t g_locktimers;
```
##########
sched/irq/irq_attach.c:
##########
@@ -36,6 +36,7 @@
* Private Data
****************************************************************************/
+static spinlock_t g_irq_attach_lock = SP_UNLOCKED;
Review Comment:
```suggestion
static spinlock_t g_irq lock = SP_UNLOCKED;
```
##########
sched/mqueue/mq_initialize.c:
##########
@@ -78,6 +78,8 @@ struct list_node g_msgfree;
struct list_node g_msgfreeirq;
+spinlock_t g_msgfree_lock = SP_UNLOCKED;
Review Comment:
```suggestion
spinlock_t g_msgfreelock = SP_UNLOCKED;
```
##########
sched/irq/irq_chain.c:
##########
@@ -57,6 +57,7 @@ static struct irqchain_s
g_irqchainpool[CONFIG_PREALLOC_IRQCHAIN];
*/
static sq_queue_t g_irqchainfreelist;
+static spinlock_t g_irq_chain_lock = SP_UNLOCKED;
Review Comment:
```suggestion
static spinlock_t g_irqchainlock = SP_UNLOCKED;
```
##########
include/nuttx/sched.h:
##########
@@ -571,6 +571,8 @@ struct task_group_s
/* Virtual memory mapping info ********************************************/
struct mm_map_s tg_mm_map; /* Task group virtual memory mappings */
+
+ spinlock_t lock; /* lock */
Review Comment:
```suggestion
spinlock_t tg_lock; /* lock */
```
##########
sched/clock/clock_systime_timespec.c:
##########
@@ -36,11 +36,35 @@
#include <nuttx/spinlock.h>
#include "clock/clock.h"
+#include "clock/clock_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
+int clock_systime_timespec_nolock(FAR struct timespec *ts)
Review Comment:
remove nolock version
##########
sched/clock/clock_settime.c:
##########
@@ -71,16 +73,17 @@ void nxclock_settime(clockid_t clock_id, FAR const struct
timespec *tp)
* possible.
*/
- flags = enter_critical_section();
+ flags = spin_lock_irqsave(&g_basetime_lock);
Review Comment:
move after line 83
--
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]