qmsk/net/lib/event2/event.pxd
changeset 39 075eaafa80a7
child 41 02f7c0539843
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk/net/lib/event2/event.pxd	Fri Aug 28 21:58:47 2009 +0300
@@ -0,0 +1,33 @@
+"""
+    Core `struct event` type.
+"""
+
+cimport qmsk.net.lib.event2.lib as lib
+
+# internal helper method for handling timeout arguments
+cdef lib.timeval* build_timeout (lib.timeval *tv, object timeout = ?) except? <lib.timeval *>-1
+
+cdef class event :
+    """
+        Create a new event object with the given parameters.
+        
+        An event tracks a single OS file descriptor with some set of events (EV_READ/EV_WRITE) and an optional timeout.
+        
+        An event is associated with some event_base, which handles the event mechanism.
+        
+        Arguments:
+            base        - event_base to use for this event
+            fd          - OS file descriptor to watch, or -1
+            events      - bitmask of EV_* flags that represents the events to wait for
+
+        When the event fires, it will "call" this event object, so __call__ gets the following parameters:
+            fd          - OS file descriptor the event occured on, or -1
+            mask        - bitmask of EV_* flags that represents the triggered event
+    
+        The default implementation of __call__ does nothing. The method's return value will be ignored, and should be
+        None. Any errors raised by the callback will be printed out as warning messages, and ignored.
+    """
+
+    # the underlying event object
+    cdef lib.event *ev
+