remove the LUMIERA_RESTRICT macro

all functions using restrict are inline and can be properly optimized by
the compiler, no restrcit necessary
This commit is contained in:
Christian Thaeter 2010-01-13 13:00:13 +01:00
parent 63346c7dff
commit a287b13481
5 changed files with 36 additions and 85 deletions

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{