~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_pthread.h

  • Committer: Stewart Smith
  • Date: 2008-09-25 10:04:06 UTC
  • mto: This revision was merged to the branch mainline in revision 408.
  • Revision ID: stewart@flamingspork.com-20080925100406-hld92f4dr4nuar3a
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test

Show diffs side-by-side

added added

removed removed

Lines of Context:
218
218
#define set_timespec_nsec(ABSTIME,NSEC) \
219
219
{ \
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)); \
223
223
}
224
224
#endif /* !set_timespec_nsec */
225
225
#else
236
236
#define set_timespec_nsec(ABSTIME,NSEC) \
237
237
{\
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)); \
241
241
}
242
242
#endif /* !set_timespec_nsec */
243
243
#endif /* HAVE_TIMESPEC_TS_SEC */
248
248
{
249
249
  pthread_mutex_t global,mutex;
250
250
  const char *file;
251
 
  uint32_t line,count;
 
251
  uint line,count;
252
252
  pthread_t thread;
253
253
} safe_mutex_t;
254
254
 
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,
261
 
                   uint32_t line);
 
261
                   uint line);
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);
266
266
 
272
272
typedef struct st_my_pthread_fastmutex_t
273
273
{
274
274
  pthread_mutex_t mutex;
275
 
  uint32_t spins;
 
275
  uint spins;
276
276
} my_pthread_fastmutex_t;
277
277
void fastmutex_global_init(void);
278
278
 
426
426
};
427
427
 
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())
431
431
/*
432
432
  Keep track of shutdown,signal, and main threads so that my_end() will not
439
439
#define THD_LIB_NPTL  2
440
440
#define THD_LIB_LT    4
441
441
 
442
 
extern uint32_t thd_lib_detected;
 
442
extern uint thd_lib_detected;
443
443
 
444
444
/*
445
445
  thread_safe_xxx functions are for critical statistic or counters.