twisted.internet.kqreactor.html [plain text]
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>twisted.internet.kqreactor</title>
<link rel="stylesheet" href="epydoc.css" type="text/css"></link>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
<tr valign="center">
<th class="navbar"> <a class="navbar" href="twisted.html">Home</a> </th>
<th class="navbar"> <a class="navbar" href="trees.html">Trees</a> </th>
<th class="navbar"> <a class="navbar" href="indices.html">Index</a> </th>
<th class="navbar"> <a class="navbar" href="help.html">Help</a> </th>
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center">
<p class="nomargin">
<a class="navbar" target="_top" href="http://twistedmatrix.com/">Twisted 1.3.0rc1</a>
</p></th></tr></table>
</th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<font size="-1"><b class="breadcrumbs">
<a href="twisted.html">Package twisted</a> ::
<a href="twisted.internet.html">Package internet</a> ::
Module kqreactor
</b></font></br>
</td>
<td><table cellpadding="0" cellspacing="0">
<tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a> | <a href="twisted.internet.kqreactor.html" target="_top">no frames</a>]</font></td></tr>
</table></td>
</tr></table>
<!-- =========== START OF MODULE DESCRIPTION =========== -->
<h2 class="module">Module twisted.internet.kqreactor</h2>
<pre class="literalblock">
A kqueue()/kevent() based implementation of the Twisted main loop.
To install the event loop (and you should do this before any connections,
listeners or connectors are added)::
| from twisted.internet import kqreactor
| kqreactor.install()
This reactor only works on FreeBSD and requires PyKQueue 1.3, which is
available at: U{http://people.freebsd.org/~dwhite/PyKQueue/}
API Stability: stable
Maintainer: U{Itamar Shtull-Trauring<mailto:twisted@itamarst.org>}
You're going to need to patch PyKqueue:
=====================================================
--- PyKQueue-1.3/kqsyscallmodule.c Sun Jan 28 21:59:50 2001
+++ PyKQueue-1.3/kqsyscallmodule.c.new Tue Jul 30 18:06:08 2002
@@ -137,7 +137,7 @@
}
statichere PyTypeObject KQEvent_Type = {
- PyObject_HEAD_INIT(NULL)
+ PyObject_HEAD_INIT(&PyType_Type)
0, // ob_size
"KQEvent", // tp_name
sizeof(KQEventObject), // tp_basicsize
@@ -291,13 +291,14 @@
/* Build timespec for timeout */
totimespec.tv_sec = timeout / 1000;
- totimespec.tv_nsec = (timeout % 1000) * 100000;
+ totimespec.tv_nsec = (timeout % 1000) * 1000000;
// printf("timespec: sec=%d nsec=%d
", totimespec.tv_sec, totimespec.tv_nsec);
/* Make the call */
-
+ Py_BEGIN_ALLOW_THREADS
gotNumEvents = kevent (self->fd, changelist, haveNumEvents, triggered, wantNumEvents, &totimespec);
+ Py_END_ALLOW_THREADS
/* Don't need the input event list anymore, so get rid of it */
free (changelist);
@@ -361,7 +362,7 @@
statichere PyTypeObject KQueue_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
- PyObject_HEAD_INIT(NULL)
+ PyObject_HEAD_INIT(&PyType_Type)
0, /*ob_size*/
"KQueue", /*tp_name*/
sizeof(KQueueObject), /*tp_basicsize*/
</pre>
<hr/>
<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
<tr valign="center">
<th class="navbar"> <a class="navbar" href="twisted.html">Home</a> </th>
<th class="navbar"> <a class="navbar" href="trees.html">Trees</a> </th>
<th class="navbar"> <a class="navbar" href="indices.html">Index</a> </th>
<th class="navbar"> <a class="navbar" href="help.html">Help</a> </th>
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center">
<p class="nomargin">
<a class="navbar" target="_top" href="http://twistedmatrix.com/">Twisted 1.3.0rc1</a>
</p></th></tr></table>
</th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left"><font size="-2">Generated by Epydoc 2.0 on Sat May 15 20:08:12 2004</font></td>
<td align="right"><a href="http://epydoc.sourceforge.net"
><font size="-2">http://epydoc.sf.net</font></a></td>
</tr>
</table>
</body>
</html>