218
218
#define set_timespec_nsec(ABSTIME,NSEC) \
220
220
uint64_t now= my_getsystime() + (NSEC/100); \
221
(ABSTIME).ts_sec= (now / 10000000UL); \
222
(ABSTIME).ts_nsec= (now % 10000000UL * 100 + ((NSEC) % 100)); \
221
(ABSTIME).ts_sec= (now / 10000000ULL); \
222
(ABSTIME).ts_nsec= (now % 10000000ULL * 100 + ((NSEC) % 100)); \
224
224
#endif /* !set_timespec_nsec */
236
236
#define set_timespec_nsec(ABSTIME,NSEC) \
238
238
uint64_t now= my_getsystime() + (NSEC/100); \
239
(ABSTIME).tv_sec= (time_t) (now / 10000000UL); \
240
(ABSTIME).tv_nsec= (long) (now % 10000000UL * 100 + ((NSEC) % 100)); \
239
(ABSTIME).tv_sec= (time_t) (now / 10000000ULL); \
240
(ABSTIME).tv_nsec= (long) (now % 10000000ULL * 100 + ((NSEC) % 100)); \
242
242
#endif /* !set_timespec_nsec */
243
243
#endif /* HAVE_TIMESPEC_TS_SEC */
249
249
pthread_mutex_t global,mutex;
250
250
const char *file;
252
252
pthread_t thread;
255
255
int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr,
256
const char *file, uint32_t line);
257
int safe_mutex_lock(safe_mutex_t *mp, bool try_lock, const char *file, uint32_t line);
258
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint32_t line);
259
int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint32_t line);
256
const char *file, uint line);
257
int safe_mutex_lock(safe_mutex_t *mp, bool try_lock, const char *file, uint line);
258
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line);
259
int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
260
260
int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
262
262
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
263
struct timespec *abstime, const char *file, uint32_t line);
263
struct timespec *abstime, const char *file, uint line);
264
264
void safe_mutex_global_init(void);
265
265
void safe_mutex_end(FILE *file);
428
428
extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
429
extern uint32_t my_thread_end_wait_time;
429
extern uint my_thread_end_wait_time;
430
430
#define my_thread_var (_my_thread_var())
432
432
Keep track of shutdown,signal, and main threads so that my_end() will not