… | |
… | |
43 | |
43 | |
44 | #include "eio.h" |
44 | #include "eio.h" |
45 | #include "ecb.h" |
45 | #include "ecb.h" |
46 | |
46 | |
47 | #ifdef EIO_STACKSIZE |
47 | #ifdef EIO_STACKSIZE |
48 | # define XTHREAD_STACKSIZE EIO_STACKSIZE |
48 | # define X_STACKSIZE EIO_STACKSIZE |
49 | #endif |
49 | #endif |
50 | #include "xthread.h" |
50 | #include "xthread.h" |
51 | |
51 | |
52 | #include <errno.h> |
52 | #include <errno.h> |
53 | #include <stddef.h> |
53 | #include <stddef.h> |
… | |
… | |
105 | #ifdef _WIN32 |
105 | #ifdef _WIN32 |
106 | |
106 | |
107 | #undef PAGESIZE |
107 | #undef PAGESIZE |
108 | #define PAGESIZE 4096 /* GetSystemInfo? */ |
108 | #define PAGESIZE 4096 /* GetSystemInfo? */ |
109 | |
109 | |
|
|
110 | /* TODO: look at how perl does stat (non-sloppy), unlink (ro-files), utime, link */ |
|
|
111 | |
110 | #ifdef EIO_STRUCT_STATI64 |
112 | #ifdef EIO_STRUCT_STATI64 |
|
|
113 | /* look at perl's non-sloppy stat */ |
111 | #define stat(path,buf) _stati64 (path,buf) |
114 | #define stat(path,buf) _stati64 (path,buf) |
112 | #define fstat(fd,buf) _fstati64 (fd,buf) |
115 | #define fstat(fd,buf) _fstati64 (fd,buf) |
113 | #endif |
116 | #endif |
114 | #define lstat(path,buf) stat (path,buf) |
117 | #define lstat(path,buf) stat (path,buf) |
115 | #define fsync(fd) (FlushFileBuffers ((HANDLE)EIO_FD_TO_WIN32_HANDLE (fd)) ? 0 : EIO_ERRNO (EBADF, -1)) |
118 | #define fsync(fd) (FlushFileBuffers ((HANDLE)EIO_FD_TO_WIN32_HANDLE (fd)) ? 0 : EIO_ERRNO (EBADF, -1)) |
… | |
… | |
321 | static void (*done_poll_cb) (void); |
324 | static void (*done_poll_cb) (void); |
322 | |
325 | |
323 | static unsigned int max_poll_time; /* reslock */ |
326 | static unsigned int max_poll_time; /* reslock */ |
324 | static unsigned int max_poll_reqs; /* reslock */ |
327 | static unsigned int max_poll_reqs; /* reslock */ |
325 | |
328 | |
326 | static volatile unsigned int nreqs; /* reqlock */ |
329 | static unsigned int nreqs; /* reqlock */ |
327 | static volatile unsigned int nready; /* reqlock */ |
330 | static unsigned int nready; /* reqlock */ |
328 | static volatile unsigned int npending; /* reqlock */ |
331 | static unsigned int npending; /* reqlock */ |
329 | static volatile unsigned int max_idle = 4; /* maximum number of threads that can idle indefinitely */ |
332 | static unsigned int max_idle = 4; /* maximum number of threads that can idle indefinitely */ |
330 | static volatile unsigned int idle_timeout = 10; /* number of seconds after which an idle threads exit */ |
333 | static unsigned int idle_timeout = 10; /* number of seconds after which an idle threads exit */ |
331 | |
334 | |
332 | static xmutex_t wrklock; |
335 | static xmutex_t wrklock; |
333 | static xmutex_t reslock; |
336 | static xmutex_t reslock; |
334 | static xmutex_t reqlock; |
337 | static xmutex_t reqlock; |
335 | static xcond_t reqwait; |
338 | static xcond_t reqwait; |