[v4] sys/lock.h: Add clock selection APIs for the synchronization object class

Message ID 20260305183320.1561891-1-mez3n1151@gmail.com
State New
Headers
Series [v4] sys/lock.h: Add clock selection APIs for the synchronization object class |

Commit Message

Mazen Adel Elmessady March 5, 2026, 6:33 p.m. UTC
  Updated _Semaphore_Wait_timed (which is currently unused in RTEMS)
to _Semaphore_Wait_timed_clock which
to be used in RTEMS sempahore API.
This will ease the support of the new clock
functions added in Posix Issue 8.

V2: Kept _Semaphore_Wait_timed while adding
_Semaphore_Wait_timed_clock

V3: Added _Mutex_Acquire_timed_clock()
_Mutex_recursive_Acquire_timed_clock()
_Condition_Wait_timed_clock()
_Condition_Wait_recursive_timed_clock()
To include all the clock selection APIs for
all of the synchronization object class

V4: Fixed formatting and removed the
forward declaration of struct timespec
---
 newlib/libc/sys/rtems/include/sys/lock.h | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
  

Patch

diff --git a/newlib/libc/sys/rtems/include/sys/lock.h b/newlib/libc/sys/rtems/include/sys/lock.h
index d6169025b..b2c921066 100644
--- a/newlib/libc/sys/rtems/include/sys/lock.h
+++ b/newlib/libc/sys/rtems/include/sys/lock.h
@@ -27,12 +27,11 @@ 
 #define _SYS_LOCK_H_
 
 #include <sys/cdefs.h>
+#include <sys/_timespec.h>
 #include <stddef.h>
 
 __BEGIN_DECLS
 
-struct timespec;
-
 struct _Thread_Control;
 
 struct _Thread_queue_Heads;
@@ -137,6 +136,9 @@  void _Mutex_Acquire(struct _Mutex_Control *);
 
 int _Mutex_Acquire_timed(struct _Mutex_Control *, const struct timespec *);
 
+int _Mutex_Acquire_timed_clock(struct _Mutex_Control *,
+    const struct timespec *, __clockid_t);
+
 int _Mutex_Acquire_timed_ticks(struct _Mutex_Control *, __uint32_t);
 
 int _Mutex_Try_acquire(struct _Mutex_Control *);
@@ -187,6 +189,9 @@  void _Mutex_recursive_Acquire(struct _Mutex_recursive_Control *);
 int _Mutex_recursive_Acquire_timed(struct _Mutex_recursive_Control *,
     const struct timespec *);
 
+int _Mutex_recursive_Acquire_timed_clock(struct _Mutex_recursive_Control *,
+    const struct timespec *, __clockid_t);
+
 int _Mutex_recursive_Acquire_timed_ticks(struct _Mutex_recursive_Control *,
     __uint32_t);
 
@@ -237,6 +242,9 @@  void _Condition_Wait(struct _Condition_Control *, struct _Mutex_Control *);
 int _Condition_Wait_timed(struct _Condition_Control *,
     struct _Mutex_Control *, const struct timespec *);
 
+int _Condition_Wait_timed_clock(struct _Condition_Control *,
+    struct _Mutex_Control *, const struct timespec *, __clockid_t);
+
 int _Condition_Wait_timed_ticks(struct _Condition_Control *,
     struct _Mutex_Control *, __uint32_t);
 
@@ -246,6 +254,9 @@  void _Condition_Wait_recursive(struct _Condition_Control *,
 int _Condition_Wait_recursive_timed(struct _Condition_Control *,
     struct _Mutex_recursive_Control *, const struct timespec *);
 
+int _Condition_Wait_recursive_timed_clock(struct _Condition_Control *,
+    struct _Mutex_recursive_Control *, const struct timespec *, __clockid_t);
+
 int _Condition_Wait_recursive_timed_ticks(struct _Condition_Control *,
     struct _Mutex_recursive_Control *, __uint32_t);
 
@@ -298,6 +309,9 @@  void _Semaphore_Wait(struct _Semaphore_Control *);
 int _Semaphore_Wait_timed(struct _Semaphore_Control *,
     const struct timespec *);
 
+int _Semaphore_Wait_timed_clock(struct _Semaphore_Control *,
+    const struct timespec *, __clockid_t);
+
 int _Semaphore_Wait_timed_ticks(struct _Semaphore_Control *, __uint32_t);
 
 int _Semaphore_Try_wait(struct _Semaphore_Control *);