Commit 4f7d3298 authored by Jason Madden's avatar Jason Madden

Use a better size for vfd_socket_t on windows, and make sure to pass the VFD object to the watcher.

parent 04af61ff
......@@ -810,7 +810,7 @@ cdef public class io(watcher) [object PyGeventIOObject, type PyGeventIO_Type]:
raise ValueError('illegal event mask: %r' % events)
# All the vfd_functions are no-ops on POSIX
cdef int vfd = libev.vfd_open(fd)
libev.ev_io_init(&self._watcher, <void *>gevent_callback_io, fd, events)
libev.ev_io_init(&self._watcher, <void *>gevent_callback_io, vfd, events)
self.__watcher = <libev.ev_watcher*>&self._watcher
def __dealloc__(self):
......
# From cython/includes/libc/stdint.pxd
# Longness only used for type promotion.
# Actual compile time size used for conversions.
# 7.18 Integer types <stdint.h>
cdef extern from "<stdint.h>" nogil:
# 7.18.1.4 Integer types capable of holding object pointers
ctypedef ssize_t intptr_t
cdef extern from "libev_vfd.h":
# cython doesn't process pre-processor directives, so they
# don't matter in this file. It just takes the last definition it sees.
ctypedef long long vfd_socket_t
ctypedef intptr_t vfd_socket_t
long vfd_get(int)
int vfd_open(long) except -1
void vfd_free(int)
cdef extern from "libev.h":
cdef extern from "libev.h" nogil:
int EV_MINPRI
int EV_MAXPRI
......
#ifdef _WIN32
# ifdef _WIN64
typedef PY_LONG_LONG vfd_socket_t;
# define vfd_socket_object PyLong_FromLongLong
# else /* _WIN32 && !_WIN64 */
typedef long vfd_socket_t;
# define vfd_socket_object PyInt_FromLong
#endif /* _WIN64 */
/* see discussion in the libuv directory: this is a SOCKET which is a
HANDLE which is a PVOID (even though they're really small ints),
and CPython and PyPy return that SOCKET cast to an int from
fileno()
*/
typedef intptr_t vfd_socket_t;
#define vfd_socket_object PyLong_FromLongLong
#ifdef LIBEV_EMBED
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment