source: trunk/GDE/RAxML/ming.h

Last change on this file was 13845, checked in by westram, 10 years ago
  • remove executable flag
File size: 2.8 KB
Line 
1/*
2 *   Copyright (C) 2009, 2010, 2011 Lockless Inc., Steven Von Fuerst.
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* Coompiler specific details - gcc */
19#ifndef LL_MING_H
20#define LL_MING_H
21
22#ifndef WINDOWS
23#define WINDOWS
24#endif
25
26#include <windows.h>
27
28void set_enomem(void);
29
30#define __thread__ __thread __attribute__ ((tls_model ("initial-exec")))
31
32/* #define HAVE_PTHREADS */
33/* #define HAVE_SYS_SELECT */
34/* #define HAVE_SYS_SOCKET */
35/* #define HAVE_NETINET_IN */
36/* #define HAVVE_SYS_MMAN */
37
38#define cache_align __attribute__((aligned(64)))
39#define noinline __attribute__((__noinline__))
40#define prefetch(x) __builtin_prefetch(x)
41#define barrier() asm volatile("": : :"memory")
42#define forget(v) asm volatile("": "=m"(v) :"m"(v))
43#define cpu_relax() asm volatile("rep; nop\n": : :"memory")
44#define likely(x) __builtin_expect(!!(x), 1)
45#define unlikely(x) __builtin_expect(!!(x), 0)
46#define gcc_used __attribute__((used))
47#define _export_
48
49#define GCC_ASM
50
51#include <windows.h>
52
53struct iovec
54{
55        void *iov_base;
56        size_t iov_len;
57};
58
59#ifndef EBUSY
60#define EBUSY 1
61#endif
62#define pthread_mutex_lock EnterCriticalSection
63#define pthread_mutex_unlock LeaveCriticalSection
64#define pthread_mutex_t CRITICAL_SECTION
65static inline int pthread_mutex_trylock(pthread_mutex_t *m)
66{
67        return TryEnterCriticalSection(m) ? 0 : EBUSY;
68}
69#define pthread_mutex_init(L, A) InitializeCriticalSection(L)
70#define pthread_mutex_destroy(L) DeleteCriticalSection(L)
71#define pthread_cond_init(C, A) InitializeConditionVariable(C)
72#define pthread_cond_signal(C) WakeConditionVariable(C)
73#define pthread_cond_broadcast(C) WakeAllConditionVariable(C)
74#define pthread_cond_wait(C, M) SleepConditionVariableCS((C), (M), INFINITE)
75#define pthread_cond_t CONDITION_VARIABLE
76#define pthread_key_create 1
77
78#define MAP_FAILED      NULL
79
80#include <stdlib.h>
81#include <stdio.h>
82
83static __attribute__((format (ms_printf, 2, 3))) inline void errx(int ret, const char *fmt, ...)
84{
85        va_list va;
86
87        /* Get args */
88        va_start(va, fmt);
89
90        /* Print it */
91        vfprintf(stderr, fmt, va);
92
93        /* Make sure it is printed */
94        fflush(NULL);
95
96        /* Done */
97        va_end(va);
98
99        exit(ret);
100}
101
102#ifndef _CRT_ERRNO_DEFINED
103#define _CRT_ERRNO_DEFINED
104__cdecl int _set_errno(int err);
105__cdecl int _get_errno(int *err);
106#endif /* _CRT_ERRNO_DEFINED */
107
108#endif /* LL_GCC_H */
Note: See TracBrowser for help on using the repository browser.