This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 1ff1cb88a0d12f957e85e24c1816344c41f3980e
Author: zhanghongyu <[email protected]>
AuthorDate: Thu Oct 30 15:32:18 2025 +0800

    netdev_lock: add netdev_trylock/breaklock/restorelock
    
    Add netdev_trylock(), netdev_breaklock() and netdev_restorelock() as
    macros over the matching nxrmutex operations, so callers can try, break
    and restore the per-device lock the same way as the other rmutex-based
    network locks.
    
    Signed-off-by: zhanghongyu <[email protected]>
---
 include/nuttx/net/net.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h
index 3bfbdbfef50..03b5cc0b9d5 100644
--- a/include/nuttx/net/net.h
+++ b/include/nuttx/net/net.h
@@ -100,6 +100,11 @@
 
 #define netdev_lock(dev)    nxrmutex_lock(&(dev)->d_lock)
 #define netdev_unlock(dev)  nxrmutex_unlock(&(dev)->d_lock)
+#define netdev_trylock(dev) nxrmutex_trylock(&(dev)->d_lock)
+#define netdev_breaklock(dev, pcount) \
+                            nxrmutex_breaklock(&(dev)->d_lock, pcount)
+#define netdev_restorelock(dev, count) \
+                            nxrmutex_restorelock(&(dev)->d_lock, count)
 
 /****************************************************************************
  * Public Types

Reply via email to