~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/my_pthread.h

  • Committer: Monty Taylor
  • Date: 2010-03-26 23:25:28 UTC
  • mto: (1471.3.2 drizzled-as-lib)
  • mto: This revision was merged to the branch mainline in revision 1479.
  • Revision ID: mordred@inaugust.com-20100326232528-wkbpffu3rbjz2euy
Moved and reworked a wrapper around sigset - which we shouldn't be using
anyway.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#define DRIZZLED_INTERNAL_MY_PTHREAD_H
20
20
 
21
21
#include <unistd.h>
22
 
#include <signal.h>
23
22
 
24
23
#ifndef ETIME
25
24
#define ETIME ETIMEDOUT                         /* For FreeBSD */
45
44
#define pthread_handler_t void *
46
45
typedef void *(* pthread_handler)(void *);
47
46
 
48
 
 
49
 
/*
50
 
  We define my_sigset() and use that instead of the system sigset() so that
51
 
  we can favor an implementation based on sigaction(). On some systems, such
52
 
  as Mac OS X, sigset() results in flags such as SA_RESTART being set, and
53
 
  we want to make sure that no such flags are set.
54
 
*/
55
 
#if !defined(my_sigset)
56
 
#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
57
 
                            assert((A) != 0);                          \
58
 
                            sigemptyset(&l_set);                            \
59
 
                            l_s.sa_handler = (B);                           \
60
 
                            l_s.sa_mask   = l_set;                          \
61
 
                            l_s.sa_flags   = 0;                             \
62
 
                            l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
63
 
                            assert(l_rc == 0);                         \
64
 
                          } while (0)
65
 
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
66
 
#define my_sigset(A,B) sigset((A),(B))
67
 
#elif !defined(my_sigset)
68
 
#define my_sigset(A,B) signal((A),(B))
69
 
#endif
70
 
 
71
47
#ifndef my_pthread_attr_setprio
72
48
#ifdef HAVE_PTHREAD_ATTR_SETPRIO
73
49
#define my_pthread_attr_setprio(A,B) pthread_attr_setprio((A),(B))