diff --git a/src/lib/condition.h b/src/lib/condition.h index 43df0e272..293d0143e 100644 --- a/src/lib/condition.h +++ b/src/lib/condition.h @@ -52,10 +52,8 @@ cnd, (lumiera_sectionlock_unlock_fn) lumiera_condition_unlock \ NOBUG_ALPHA_COMMA(&NOBUG_FLAG(nobugflag)) NOBUG_ALPHA_COMMA_NULL}; \ ({ \ - if (lumiera_lock_section_.lock) \ - lumiera_lock_section_.lock = \ - lumiera_condition_lock (cnd, &NOBUG_FLAG(nobugflag), &lumiera_lock_section_.rh); \ - lumiera_lock_section_.lock; \ + lumiera_lock_section_.lock = \ + lumiera_condition_lock (cnd, &NOBUG_FLAG(nobugflag), &lumiera_lock_section_.rh); \ }); \ ({ \ LUMIERA_CONDITION_SECTION_UNLOCK; \ @@ -125,7 +123,7 @@ */ #define LUMIERA_CONDITION_SIGNAL \ do { \ - REQUIRE (lumiera_lock_section_.lock, "Condition mutex not locked"); \ + REQUIRE (lumiera_cond_section_.lock, "Condition mutex not locked"); \ lumiera_condition_signal (lumiera_lock_section_.lock, \ lumiera_lock_section_.flag); \ } while (0) @@ -138,7 +136,7 @@ */ #define LUMIERA_CONDITION_BROADCAST \ do { \ - REQUIRE (lumiera_lock_section_.lock, "Condition mutex not locked"); \ + REQUIRE (lumiera_cond_section_.lock, "Condition mutex not locked"); \ lumiera_condition_broadcast (lumiera_lock_section_.lock, \ lumiera_lock_section_.flag); \ } while (0) @@ -218,18 +216,9 @@ lumiera_condition_trylock (LumieraCondition self, struct nobug_flag* flag, struc } -#ifndef LUMIERA_RESTRICT -# ifdef __cplusplus /* C++ doesnt support restrict */ -# define LUMIERA_RESTRICT -# else -# define LUMIERA_RESTRICT restrict -# endif -#endif - - static inline LumieraCondition lumiera_condition_timedlock (LumieraCondition self, - const struct timespec* LUMIERA_RESTRICT timeout, + const struct timespec* timeout, struct nobug_flag* flag, struct nobug_resource_user** handle) { diff --git a/src/lib/mutex.h b/src/lib/mutex.h index 733fb06a6..04a859b91 100644 --- a/src/lib/mutex.h +++ b/src/lib/mutex.h @@ -175,16 +175,6 @@ lumiera_mutex_trylock (LumieraMutex self, struct nobug_flag* flag, struct nobug_ return self; } - -#ifndef LUMIERA_RESTRICT -# ifdef __cplusplus /* C++ doesnt support restrict */ -# define LUMIERA_RESTRICT -# else -# define LUMIERA_RESTRICT restrict -# endif -#endif - - /** * Try to lock a mutex variable with a timeout * @param self is a pointer to the mutex to be destroyed @@ -195,7 +185,7 @@ lumiera_mutex_trylock (LumieraMutex self, struct nobug_flag* flag, struct nobug_ */ static inline LumieraMutex lumiera_mutex_timedlock (LumieraMutex self, - const struct timespec* LUMIERA_RESTRICT timeout, + const struct timespec* timeout, struct nobug_flag* flag, struct nobug_resource_user** handle) { diff --git a/src/lib/reccondition.h b/src/lib/reccondition.h index 37ea408ea..0af8f52e0 100644 --- a/src/lib/reccondition.h +++ b/src/lib/reccondition.h @@ -44,19 +44,17 @@ * @param nobugflag NoBug flag used to log actions on the condition * @param cnd Condition variable to be locked */ -#define LUMIERA_RECCONDITION_SECTION(nobugflag, cnd) \ - for (lumiera_sectionlock NOBUG_CLEANUP(lumiera_sectionlock_ensureunlocked) \ - lumiera_lock_section_ = { \ - cnd, (lumiera_sectionlock_unlock_fn) lumiera_reccondition_unlock \ - NOBUG_ALPHA_COMMA(&NOBUG_FLAG(nobugflag)) NOBUG_ALPHA_COMMA_NULL}; \ - ({ \ - if (lumiera_lock_section_.lock) \ - lumiera_lock_section_.lock = \ - lumiera_reccondition_lock (cnd, &NOBUG_FLAG(nobugflag), &lumiera_lock_section_.rh); \ - lumiera_lock_section_.lock; \ - }); \ - ({ \ - LUMIERA_RECCONDITION_SECTION_UNLOCK; \ +#define LUMIERA_RECCONDITION_SECTION(nobugflag, cnd) \ + for (lumiera_sectionlock NOBUG_CLEANUP(lumiera_sectionlock_ensureunlocked) \ + lumiera_lock_section_ = { \ + cnd, (lumiera_sectionlock_unlock_fn) lumiera_reccondition_unlock \ + NOBUG_ALPHA_COMMA(&NOBUG_FLAG(nobugflag)) NOBUG_ALPHA_COMMA_NULL}; \ + ({ \ + lumiera_lock_section_.lock = \ + lumiera_reccondition_lock (cnd, &NOBUG_FLAG(nobugflag), &lumiera_lock_section_.rh); \ + }); \ + ({ \ + LUMIERA_RECCONDITION_SECTION_UNLOCK; \ })) @@ -94,7 +92,7 @@ do { \ REQUIRE (lumiera_lock_section_.lock, "Reccondition mutex not locked"); \ lumiera_reccondition_wait (lumiera_lock_section_.lock, \ - lumiera_lock_section_.flag, \ + NOBUG_FLAG_RAW(lumiera_lock_section_.flag), \ &lumiera_lock_section_.rh); \ } while (!(expr)) @@ -106,14 +104,14 @@ * @param timeout time when the wait expired * sets LUMIERA_ERROR_LOCK_TIMEOUT when the timeout passed */ -#define LUMIERA_RECCONDITION_TIMEDWAIT(expr, timeout) \ - do { \ - REQUIRE (lumiera_lock_section_.lock, "Reccondition mutex not locked"); \ - if (!lumiera_reccondition_timedwait (lumiera_lock_section_.lock, \ - timeout, \ - lumiera_lock_section_.flag, \ - &lumiera_lock_section_.rh)) \ - break; \ +#define LUMIERA_RECCONDITION_TIMEDWAIT(expr, timeout) \ + do { \ + REQUIRE (lumiera_lock_section_.lock, "Reccondition mutex not locked"); \ + if (!lumiera_reccondition_timedwait (lumiera_lock_section_.lock, \ + timeout, \ + NOBUG_FLAG_RAW(lumiera_lock_section_.flag), \ + &lumiera_lock_section_.rh)) \ + break; \ } while (!(expr)) @@ -128,7 +126,7 @@ do { \ REQUIRE (lumiera_lock_section_.lock, "Reccondition mutex not locked"); \ lumiera_reccondition_signal (lumiera_lock_section_.lock, \ - lumiera_lock_section_.flag); \ + NOBUG_FLAG_RAW(lumiera_lock_section_.flag)); \ } while (0) @@ -137,11 +135,11 @@ * Must be used inside a RECCONDITION_SECTION. * Wakes all threads waiting on the condition variable */ -#define LUMIERA_RECCONDITION_BROADCAST \ - do { \ - REQUIRE (lumiera_lock_section_.lock, "Reccondition mutex not locked"); \ - lumiera_reccondition_broadcast (lumiera_lock_section_.lock, \ - lumiera_lock_section_.flag); \ +#define LUMIERA_RECCONDITION_BROADCAST \ + do { \ + REQUIRE (lumiera_lock_section_.lock, "Reccondition mutex not locked"); \ + lumiera_reccondition_broadcast (lumiera_lock_section_.lock, \ + NOBUG_FLAG_RAW(lumiera_lock_section_.flag)); \ } while (0) @@ -220,18 +218,9 @@ lumiera_reccondition_trylock (LumieraReccondition self, struct nobug_flag* flag, } -#ifndef LUMIERA_RESTRICT -# ifdef __cplusplus /* C++ doesnt support restrict */ -# define LUMIERA_RESTRICT -# else -# define LUMIERA_RESTRICT restrict -# endif -#endif - - static inline LumieraReccondition lumiera_reccondition_timedlock (LumieraReccondition self, - const struct timespec* LUMIERA_RESTRICT timeout, + const struct timespec* timeout, struct nobug_flag* flag, struct nobug_resource_user** handle) { diff --git a/src/lib/recmutex.h b/src/lib/recmutex.h index 18aaf11a8..9754e56b1 100644 --- a/src/lib/recmutex.h +++ b/src/lib/recmutex.h @@ -151,18 +151,9 @@ lumiera_recmutex_trylock (LumieraRecmutex self, struct nobug_flag* flag, struct } -#ifndef LUMIERA_RESTRICT -# ifdef __cplusplus /* C++ doesnt support restrict */ -# define LUMIERA_RESTRICT -# else -# define LUMIERA_RESTRICT restrict -# endif -#endif - - static inline LumieraRecmutex lumiera_recmutex_timedlock (LumieraRecmutex self, - const struct timespec* LUMIERA_RESTRICT timeout, + const struct timespec* timeout, struct nobug_flag* flag, struct nobug_resource_user** handle) { diff --git a/src/lib/rwlock.h b/src/lib/rwlock.h index 0d9117554..a059f3767 100644 --- a/src/lib/rwlock.h +++ b/src/lib/rwlock.h @@ -202,17 +202,9 @@ lumiera_rwlock_tryrdlock (LumieraRWLock self, struct nobug_flag* flag, struct no } -#ifndef LUMIERA_RESTRICT -# ifdef __cplusplus /* C++ doesnt support restrict */ -# define LUMIERA_RESTRICT -# else -# define LUMIERA_RESTRICT restrict -# endif -#endif - static inline LumieraRWLock lumiera_rwlock_timedrdlock (LumieraRWLock self, - const struct timespec* LUMIERA_RESTRICT timeout, + const struct timespec* timeout, struct nobug_flag* flag, struct nobug_resource_user** handle) { @@ -282,7 +274,7 @@ lumiera_rwlock_trywrlock (LumieraRWLock self, struct nobug_flag* flag, struct no static inline LumieraRWLock lumiera_rwlock_timedwrlock (LumieraRWLock self, - const struct timespec* LUMIERA_RESTRICT timeout, + const struct timespec* timeout, struct nobug_flag* flag, struct nobug_resource_user** handle) {