105
105
#define my_sigset(A,B) signal((A),(B))
108
#ifndef my_pthread_setprio
109
#if defined(HAVE_PTHREAD_SETPRIO_NP) /* FSU threads */
110
#define my_pthread_setprio(A,B) pthread_setprio_np((A),(B))
111
#elif defined(HAVE_PTHREAD_SETPRIO)
112
#define my_pthread_setprio(A,B) pthread_setprio((A),(B))
114
extern void my_pthread_setprio(pthread_t thread_id,int prior);
108
118
#ifndef my_pthread_attr_setprio
109
119
#ifdef HAVE_PTHREAD_ATTR_SETPRIO
110
120
#define my_pthread_attr_setprio(A,B) pthread_attr_setprio((A),(B))
208
218
#define set_timespec_nsec(ABSTIME,NSEC) \
210
220
uint64_t now= my_getsystime() + (NSEC/100); \
211
(ABSTIME).ts_sec= (now / 10000000UL); \
212
(ABSTIME).ts_nsec= (now % 10000000UL * 100 + ((NSEC) % 100)); \
221
(ABSTIME).ts_sec= (now / 10000000ULL); \
222
(ABSTIME).ts_nsec= (now % 10000000ULL * 100 + ((NSEC) % 100)); \
214
224
#endif /* !set_timespec_nsec */
226
236
#define set_timespec_nsec(ABSTIME,NSEC) \
228
238
uint64_t now= my_getsystime() + (NSEC/100); \
229
(ABSTIME).tv_sec= (time_t) (now / 10000000UL); \
230
(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)); \
232
242
#endif /* !set_timespec_nsec */
233
243
#endif /* HAVE_TIMESPEC_TS_SEC */
239
249
pthread_mutex_t global,mutex;
240
250
const char *file;
242
252
pthread_t thread;
245
255
int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr,
246
const char *file, uint32_t line);
247
int safe_mutex_lock(safe_mutex_t *mp, bool try_lock, const char *file, uint32_t line);
248
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint32_t line);
249
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);
250
260
int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
252
262
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
253
struct timespec *abstime, const char *file, uint32_t line);
263
struct timespec *abstime, const char *file, uint line);
254
264
void safe_mutex_global_init(void);
255
265
void safe_mutex_end(FILE *file);
388
398
/* All thread specific variables are in the following struct */
390
400
#define THREAD_NAME_SIZE 10
401
#ifndef DEFAULT_THREAD_STACK
392
Drizzle can survive with 32K, but some glibc libraries require > 128K stack
393
to resolve hostnames. Also recursive stored procedures needs stack.
404
MySQL can survive with 32K, but some glibc libraries require > 128K stack
405
To resolve hostnames. Also recursive stored procedures needs stack.
395
#define DEFAULT_THREAD_STACK (256*INT32_C(1024))
407
#define DEFAULT_THREAD_STACK (256*1024L)
409
#define DEFAULT_THREAD_STACK (192*1024)
397
413
struct st_my_thread_var
412
428
extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
413
extern uint32_t my_thread_end_wait_time;
429
extern uint my_thread_end_wait_time;
414
430
#define my_thread_var (_my_thread_var())
416
432
Keep track of shutdown,signal, and main threads so that my_end() will not