9 #ifndef app_semUtilsDerived_hpp
10 #define app_semUtilsDerived_hpp
20 #define XWC_SEM_WAIT_TS_RETVOID_DERIVED( ts, sec, nsec ) \
21 if(clock_gettime(CLOCK_REALTIME, &ts) < 0) \
23 derivedT::template log<software_critical>({__FILE__,__LINE__,errno,0,"clock_gettime"}); \
27 mx::sys::timespecAddNsec(ts, nsec);
37 #define XWC_SEM_WAIT_TS_DERIVED( ts, sec, nsec ) \
38 if(clock_gettime(CLOCK_REALTIME, &ts) < 0) \
40 derivedT::template log<software_critical>({__FILE__,__LINE__,errno,0,"clock_gettime"}); \
44 mx::sys::timespecAddNsec(ts, nsec);
52 #define XWC_SEM_TIMEDWAIT_LOOP_DERIVED( sem, ts ) \
53 if(sem_timedwait(&sem, &ts) != 0) \
58 if(errno == EINTR || errno == ETIMEDOUT) continue; \
61 derivedT::template log<software_error>({__FILE__, __LINE__,errno, "sem_timedwait"}); \
65 #define XWC_SEM_FLUSH_DERIVED( sem ) \
68 if(sem_getvalue( &sem, &semval)<0) \
70 return derivedT::template log<software_error,-1>({__FILE__, __LINE__,errno, "sem_getvalue"}); \
72 for(int i = 0; i < semval; ++i) \
74 if(sem_trywait(&sem) != 0) \
76 if(errno == EAGAIN) break; \
77 return derivedT::template log<software_error,-1>({__FILE__, __LINE__,errno, "sem_trywait"}); \