~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/my_pthread.h

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
16
/* Defines to make different thread packages compatible */
17
17
 
 
18
 
 
19
 
18
20
#ifndef DRIZZLED_INTERNAL_MY_PTHREAD_H
19
21
#define DRIZZLED_INTERNAL_MY_PTHREAD_H
20
22
 
21
23
#include <unistd.h>
22
24
 
 
25
#include <boost/date_time.hpp>
 
26
 
23
27
#ifndef ETIME
24
28
#define ETIME ETIMEDOUT                         /* For FreeBSD */
25
29
#endif
35
39
#include <synch.h>
36
40
#endif
37
41
 
 
42
#include "drizzled/visibility.h"
 
43
 
38
44
namespace drizzled
39
45
{
40
46
namespace internal
70
76
#ifndef set_timespec_nsec
71
77
#define set_timespec_nsec(ABSTIME,NSEC) \
72
78
{\
73
 
  uint64_t now= my_getsystime() + (NSEC/100); \
 
79
  boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::local_time());\
 
80
  boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));\
 
81
  uint64_t t_mark= (mytime-epoch).total_microseconds();\
 
82
  uint64_t now= t_mark + (NSEC/100); \
74
83
  (ABSTIME).tv_sec=  (time_t) (now / 10000000UL);                  \
75
84
  (ABSTIME).tv_nsec= (long) (now % 10000000UL * 100 + ((NSEC) % 100)); \
76
85
}
101
110
 
102
111
extern bool my_thread_global_init(void);
103
112
extern void my_thread_global_end(void);
104
 
extern bool my_thread_init(void);
105
 
extern void my_thread_end(void);
 
113
DRIZZLED_API bool my_thread_init(void);
 
114
DRIZZLED_API void my_thread_end(void);
106
115
extern const char *my_thread_name(void);
107
116
 
108
117
/* All thread specific variables are in the following struct */