ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/xthread.h
(Generate patch)

Comparing libeio/xthread.h (file contents):
Revision 1.14 by root, Tue Jul 19 05:12:16 2011 UTC vs.
Revision 1.17 by root, Thu May 9 03:03:24 2013 UTC

15 15
16///////////////////////////////////////////////////////////////////////////// 16/////////////////////////////////////////////////////////////////////////////
17 17
18#ifdef _WIN32 18#ifdef _WIN32
19 19
20#define NTDDI_VERSION NTDDI_WIN2K // needed to get win2000 api calls 20//#define NTDDI_VERSION NTDDI_WIN2K // needed to get win2000 api calls, fails with mingw
21#define _WIN32_WINNT 0x400 21#define _WIN32_WINNT 0x400 // maybe working alternative for mingw
22#include <stdio.h>//D 22#include <stdio.h>//D
23#include <fcntl.h> 23#include <fcntl.h>
24#include <io.h> 24#include <io.h>
25#include <time.h> 25#include <time.h>
26#include <winsock2.h> 26#include <winsock2.h>
27#include <process.h> 27#include <process.h>
28#include <windows.h> 28#include <windows.h>
29
30/* work around some bugs in ptw32 */
31#if defined(__MINGW32__) && defined(_TIMESPEC_DEFINED)
32#define HAVE_STRUCT_TIMESPEC 1
33#endif
34
29#include <pthread.h> 35#include <pthread.h>
30#define sigset_t int 36#define sigset_t int
31#define sigfillset(a) 37#define sigfillset(a)
32#define pthread_sigmask(a,b,c) 38#define pthread_sigmask(a,b,c)
33#define sigaddset(a,b) 39#define sigaddset(a,b)
45#define X_COND_SIGNAL(cond) pthread_cond_signal (&(cond)) 51#define X_COND_SIGNAL(cond) pthread_cond_signal (&(cond))
46#define X_COND_WAIT(cond,mutex) pthread_cond_wait (&(cond), &(mutex)) 52#define X_COND_WAIT(cond,mutex) pthread_cond_wait (&(cond), &(mutex))
47#define X_COND_TIMEDWAIT(cond,mutex,to) pthread_cond_timedwait (&(cond), &(mutex), &(to)) 53#define X_COND_TIMEDWAIT(cond,mutex,to) pthread_cond_timedwait (&(cond), &(mutex), &(to))
48 54
49typedef pthread_t xthread_t; 55typedef pthread_t xthread_t;
50#define X_THREAD_PROC(name) void *name (void *thr_arg) 56#define X_THREAD_PROC(name) static void *name (void *thr_arg)
51#define X_THREAD_ATFORK(a,b,c) 57#define X_THREAD_ATFORK(a,b,c)
52 58
53static int 59static int
54thread_create (xthread_t *tid, void *(*proc)(void *), void *arg) 60xthread_create (xthread_t *tid, void *(*proc)(void *), void *arg)
55{ 61{
56 int retval; 62 int retval;
57 pthread_attr_t attr; 63 pthread_attr_t attr;
58 64
59 pthread_attr_init (&attr); 65 pthread_attr_init (&attr);
130#ifndef X_STACKSIZE 136#ifndef X_STACKSIZE
131# define X_STACKSIZE sizeof (void *) * 4096 137# define X_STACKSIZE sizeof (void *) * 4096
132#endif 138#endif
133 139
134static int 140static int
135thread_create (xthread_t *tid, void *(*proc)(void *), void *arg) 141xthread_create (xthread_t *tid, void *(*proc)(void *), void *arg)
136{ 142{
137 int retval; 143 int retval;
138 sigset_t fullsigset, oldsigset; 144 sigset_t fullsigset, oldsigset;
139 pthread_attr_t attr; 145 pthread_attr_t attr;
140 146

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines