Website built from v0.17.2

This commit is contained in:
Sergey Shepelev 2015-02-25 06:30:36 +03:00
parent 7625e13d5b
commit 30aefcb0f8
53 changed files with 13083 additions and 2191 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
*.egg*
*.pyc
.*
bin/
build/
dist/
doc/changelog.rst

View File

@ -1,11 +1,31 @@
0.17.2
======
* wsgi: Provide python logging compatibility; Thanks to Sean Dague
* greendns: fix premature connection closing in DNS proxy; Thanks to Tim Simmons
* greenio: correct fd close; Thanks to Antonio Cuni and Victor Sergeyev
* green.ssl: HTTPS client Python 2.7.9+ compatibility
* setup: tests.{isolated,manual} polluted top-level packages
0.17.1
======
* greendns: fix dns.name import and Python3 compatibility
0.17
====
* Full Python3 compatibility; Thanks to Jakub Stasiak
* greendns: IPv6 support, improved handling of /etc/hosts; Thanks to Floris Bruynooghe
* tpool: make sure we return results during killall; Thanks to David Szotten
* semaphore: Don't hog a semaphore if someone else is waiting for it; Thanks to Shaun Stanworth
* green.socket: create_connection() was wrapping all exceptions in socket.error; Thanks to Donagh McCabe
* Make sure SSL retries are done using the exact same data buffer; Thanks to Lior Neudorfer
* greenio: shutdown already closed sockets without error; Thanks to David Szotten
0.16.1
======
* Wheel build 0.16.0 incorrectly shipped removed module eventlet.util.
0.16.0
======
* Fix SSL socket wrapping and Python 2.7.9 compatibility; Thanks to Jakub Stasiak
* Fix monkey_patch() on Python 3; Thanks to Victor Stinner
* Fix "maximum recursion depth exceeded in GreenSocket.__del__"; Thanks to Jakub Stasiak

74
doc/_static/basic.css vendored
View File

@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -197,7 +197,10 @@ h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink {
dt:hover > a.headerlink,
caption:hover > a.headerlink,
p.caption:hover > a.headerlink,
div.code-block-caption:hover > a.headerlink {
visibility: visible;
}
@ -314,6 +317,13 @@ table.docutils {
border-collapse: collapse;
}
table caption span.caption-number {
font-style: italic;
}
table caption span.caption-text {
}
table.docutils td, table.docutils th {
padding: 1px 8px 1px 5px;
border-top: 0;
@ -344,6 +354,25 @@ table.citation td {
border-bottom: none;
}
/* -- figures --------------------------------------------------------------- */
div.figure {
margin: 0.5em;
padding: 0.5em;
}
div.figure p.caption {
padding: 0.3em;
}
div.figure p.caption span.caption-number {
font-style: italic;
}
div.figure p.caption span.caption-text {
}
/* -- other body styles ----------------------------------------------------- */
ol.arabic {
@ -406,6 +435,10 @@ dl.glossary dt {
font-size: 1.3em;
}
.sig-paren {
font-size: larger;
}
.versionmodified {
font-style: italic;
}
@ -471,22 +504,51 @@ table.highlighttable td {
padding: 0 0.5em 0 0.5em;
}
tt.descname {
div.code-block-caption {
padding: 2px 5px;
font-size: small;
}
div.code-block-caption code {
background-color: transparent;
}
div.code-block-caption + div > div.highlight > pre {
margin-top: 0;
}
div.code-block-caption span.caption-number {
padding: 0.1em 0.3em;
font-style: italic;
}
div.code-block-caption span.caption-text {
}
div.literal-block-wrapper {
padding: 1em 1em 0;
}
div.literal-block-wrapper div.highlight {
margin: 0;
}
code.descname {
background-color: transparent;
font-weight: bold;
font-size: 1.2em;
}
tt.descclassname {
code.descclassname {
background-color: transparent;
}
tt.xref, a tt {
code.xref, a code {
background-color: transparent;
font-weight: bold;
}
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
background-color: transparent;
}

261
doc/_static/classic.css vendored Normal file
View File

@ -0,0 +1,261 @@
/*
* default.css_t
* ~~~~~~~~~~~~~
*
* Sphinx stylesheet -- default theme.
*
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: sans-serif;
font-size: 100%;
background-color: #11303d;
color: #000;
margin: 0;
padding: 0;
}
div.document {
background-color: #1c4e63;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 230px;
}
div.body {
background-color: #ffffff;
color: #000000;
padding: 0 20px 30px 20px;
}
div.footer {
color: #ffffff;
width: 100%;
padding: 9px 0 9px 0;
text-align: center;
font-size: 75%;
}
div.footer a {
color: #ffffff;
text-decoration: underline;
}
div.related {
background-color: #133f52;
line-height: 30px;
color: #ffffff;
}
div.related a {
color: #ffffff;
}
div.sphinxsidebar {
}
div.sphinxsidebar h3 {
font-family: 'Trebuchet MS', sans-serif;
color: #ffffff;
font-size: 1.4em;
font-weight: normal;
margin: 0;
padding: 0;
}
div.sphinxsidebar h3 a {
color: #ffffff;
}
div.sphinxsidebar h4 {
font-family: 'Trebuchet MS', sans-serif;
color: #ffffff;
font-size: 1.3em;
font-weight: normal;
margin: 5px 0 0 0;
padding: 0;
}
div.sphinxsidebar p {
color: #ffffff;
}
div.sphinxsidebar p.topless {
margin: 5px 10px 10px 10px;
}
div.sphinxsidebar ul {
margin: 10px;
padding: 0;
color: #ffffff;
}
div.sphinxsidebar a {
color: #98dbcc;
}
div.sphinxsidebar input {
border: 1px solid #98dbcc;
font-family: sans-serif;
font-size: 1em;
}
/* -- hyperlink styles ------------------------------------------------------ */
a {
color: #355f7c;
text-decoration: none;
}
a:visited {
color: #355f7c;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* -- body styles ----------------------------------------------------------- */
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: 'Trebuchet MS', sans-serif;
background-color: #f2f2f2;
font-weight: normal;
color: #20435c;
border-bottom: 1px solid #ccc;
margin: 20px -20px 10px -20px;
padding: 3px 0 3px 10px;
}
div.body h1 { margin-top: 0; font-size: 200%; }
div.body h2 { font-size: 160%; }
div.body h3 { font-size: 140%; }
div.body h4 { font-size: 120%; }
div.body h5 { font-size: 110%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: #c60f0f;
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
}
a.headerlink:hover {
background-color: #c60f0f;
color: white;
}
div.body p, div.body dd, div.body li {
text-align: justify;
line-height: 130%;
}
div.admonition p.admonition-title + p {
display: inline;
}
div.admonition p {
margin-bottom: 5px;
}
div.admonition pre {
margin-bottom: 5px;
}
div.admonition ul, div.admonition ol {
margin-bottom: 5px;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
div.warning {
background-color: #ffe4e4;
border: 1px solid #f66;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre {
padding: 5px;
background-color: #eeffcc;
color: #333333;
line-height: 120%;
border: 1px solid #ac9;
border-left: none;
border-right: none;
}
code {
background-color: #ecf0f3;
padding: 0 1px 0 1px;
font-size: 0.95em;
}
th {
background-color: #ede;
}
.warning code {
background: #efc2c2;
}
.note code {
background: #d6d6d6;
}
.viewcode-back {
font-family: sans-serif;
}
div.viewcode-block:target {
background-color: #f4debf;
border-top: 1px solid #ac9;
border-bottom: 1px solid #ac9;
}
div.code-block-caption {
color: #efefef;
background-color: #1c4e63;
}

View File

@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for all documentation.
*
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -91,6 +91,30 @@ jQuery.fn.highlightText = function(text, className) {
});
};
/*
* backward compatibility for jQuery.browser
* This will be supported until firefox bug is fixed.
*/
if (!jQuery.browser) {
jQuery.uaMatch = function(ua) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
jQuery.browser = {};
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
}
/**
* Small JavaScript module for the documentation.
*/
@ -152,9 +176,10 @@ var Documentation = {
/**
* workaround a firefox stupidity
* see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
*/
fixFirefoxAnchorBug : function() {
if (document.location.hash && $.browser.mozilla)
if (document.location.hash)
window.setTimeout(function() {
document.location.href += '';
}, 10);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

After

Width:  |  Height:  |  Size: 347 B

BIN
doc/_static/down.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

After

Width:  |  Height:  |  Size: 347 B

BIN
doc/_static/file.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 358 B

10308
doc/_static/jquery-1.11.1.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

BIN
doc/_static/minus.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 173 B

BIN
doc/_static/plus.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 173 B

View File

@ -40,6 +40,7 @@
.highlight .nv { color: #bb60d5 } /* Name.Variable */
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #208050 } /* Literal.Number.Bin */
.highlight .mf { color: #208050 } /* Literal.Number.Float */
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
.highlight .mi { color: #208050 } /* Literal.Number.Integer */

View File

@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilties for the full-text search.
*
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -439,7 +439,7 @@ var Search = {
dataType: "text",
complete: function(jqxhr, textstatus) {
var data = jqxhr.responseText;
if (data !== '') {
if (data !== '' && data !== undefined) {
listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
}
Search.output.append(listItem);

999
doc/_static/underscore-1.3.1.js vendored Normal file
View File

@ -0,0 +1,999 @@
// Underscore.js 1.3.1
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
(function() {
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `global` on the server.
var root = this;
// Save the previous value of the `_` variable.
var previousUnderscore = root._;
// Establish the object that gets returned to break out of a loop iteration.
var breaker = {};
// Save bytes in the minified (but not gzipped) version:
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
// Create quick reference variables for speed access to core prototypes.
var slice = ArrayProto.slice,
unshift = ArrayProto.unshift,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
// All **ECMAScript 5** native function implementations that we hope to use
// are declared here.
var
nativeForEach = ArrayProto.forEach,
nativeMap = ArrayProto.map,
nativeReduce = ArrayProto.reduce,
nativeReduceRight = ArrayProto.reduceRight,
nativeFilter = ArrayProto.filter,
nativeEvery = ArrayProto.every,
nativeSome = ArrayProto.some,
nativeIndexOf = ArrayProto.indexOf,
nativeLastIndexOf = ArrayProto.lastIndexOf,
nativeIsArray = Array.isArray,
nativeKeys = Object.keys,
nativeBind = FuncProto.bind;
// Create a safe reference to the Underscore object for use below.
var _ = function(obj) { return new wrapper(obj); };
// Export the Underscore object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, add `_` as a global object via a string identifier,
// for Closure Compiler "advanced" mode.
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = _;
}
exports._ = _;
} else {
root['_'] = _;
}
// Current version.
_.VERSION = '1.3.1';
// Collection Functions
// --------------------
// The cornerstone, an `each` implementation, aka `forEach`.
// Handles objects with the built-in `forEach`, arrays, and raw objects.
// Delegates to **ECMAScript 5**'s native `forEach` if available.
var each = _.each = _.forEach = function(obj, iterator, context) {
if (obj == null) return;
if (nativeForEach && obj.forEach === nativeForEach) {
obj.forEach(iterator, context);
} else if (obj.length === +obj.length) {
for (var i = 0, l = obj.length; i < l; i++) {
if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
}
} else {
for (var key in obj) {
if (_.has(obj, key)) {
if (iterator.call(context, obj[key], key, obj) === breaker) return;
}
}
}
};
// Return the results of applying the iterator to each element.
// Delegates to **ECMAScript 5**'s native `map` if available.
_.map = _.collect = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
each(obj, function(value, index, list) {
results[results.length] = iterator.call(context, value, index, list);
});
if (obj.length === +obj.length) results.length = obj.length;
return results;
};
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduce && obj.reduce === nativeReduce) {
if (context) iterator = _.bind(iterator, context);
return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
}
each(obj, function(value, index, list) {
if (!initial) {
memo = value;
initial = true;
} else {
memo = iterator.call(context, memo, value, index, list);
}
});
if (!initial) throw new TypeError('Reduce of empty array with no initial value');
return memo;
};
// The right-associative version of reduce, also known as `foldr`.
// Delegates to **ECMAScript 5**'s native `reduceRight` if available.
_.reduceRight = _.foldr = function(obj, iterator, memo, context) {
var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
if (context) iterator = _.bind(iterator, context);
return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
}
var reversed = _.toArray(obj).reverse();
if (context && !initial) iterator = _.bind(iterator, context);
return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);
};
// Return the first value which passes a truth test. Aliased as `detect`.
_.find = _.detect = function(obj, iterator, context) {
var result;
any(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) {
result = value;
return true;
}
});
return result;
};
// Return all the elements that pass a truth test.
// Delegates to **ECMAScript 5**'s native `filter` if available.
// Aliased as `select`.
_.filter = _.select = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
each(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) results[results.length] = value;
});
return results;
};
// Return all the elements for which a truth test fails.
_.reject = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
each(obj, function(value, index, list) {
if (!iterator.call(context, value, index, list)) results[results.length] = value;
});
return results;
};
// Determine whether all of the elements match a truth test.
// Delegates to **ECMAScript 5**'s native `every` if available.
// Aliased as `all`.
_.every = _.all = function(obj, iterator, context) {
var result = true;
if (obj == null) return result;
if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
each(obj, function(value, index, list) {
if (!(result = result && iterator.call(context, value, index, list))) return breaker;
});
return result;
};
// Determine if at least one element in the object matches a truth test.
// Delegates to **ECMAScript 5**'s native `some` if available.
// Aliased as `any`.
var any = _.some = _.any = function(obj, iterator, context) {
iterator || (iterator = _.identity);
var result = false;
if (obj == null) return result;
if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
each(obj, function(value, index, list) {
if (result || (result = iterator.call(context, value, index, list))) return breaker;
});
return !!result;
};
// Determine if a given value is included in the array or object using `===`.
// Aliased as `contains`.
_.include = _.contains = function(obj, target) {
var found = false;
if (obj == null) return found;
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
found = any(obj, function(value) {
return value === target;
});
return found;
};
// Invoke a method (with arguments) on every item in a collection.
_.invoke = function(obj, method) {
var args = slice.call(arguments, 2);
return _.map(obj, function(value) {
return (_.isFunction(method) ? method || value : value[method]).apply(value, args);
});
};
// Convenience version of a common use case of `map`: fetching a property.
_.pluck = function(obj, key) {
return _.map(obj, function(value){ return value[key]; });
};
// Return the maximum element or (element-based computation).
_.max = function(obj, iterator, context) {
if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj);
if (!iterator && _.isEmpty(obj)) return -Infinity;
var result = {computed : -Infinity};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed >= result.computed && (result = {value : value, computed : computed});
});
return result.value;
};
// Return the minimum element (or element-based computation).
_.min = function(obj, iterator, context) {
if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj);
if (!iterator && _.isEmpty(obj)) return Infinity;
var result = {computed : Infinity};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed < result.computed && (result = {value : value, computed : computed});
});
return result.value;
};
// Shuffle an array.
_.shuffle = function(obj) {
var shuffled = [], rand;
each(obj, function(value, index, list) {
if (index == 0) {
shuffled[0] = value;
} else {
rand = Math.floor(Math.random() * (index + 1));
shuffled[index] = shuffled[rand];
shuffled[rand] = value;
}
});
return shuffled;
};
// Sort the object's values by a criterion produced by an iterator.
_.sortBy = function(obj, iterator, context) {
return _.pluck(_.map(obj, function(value, index, list) {
return {
value : value,
criteria : iterator.call(context, value, index, list)
};
}).sort(function(left, right) {
var a = left.criteria, b = right.criteria;
return a < b ? -1 : a > b ? 1 : 0;
}), 'value');
};
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
_.groupBy = function(obj, val) {
var result = {};
var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
each(obj, function(value, index) {
var key = iterator(value, index);
(result[key] || (result[key] = [])).push(value);
});
return result;
};
// Use a comparator function to figure out at what index an object should
// be inserted so as to maintain order. Uses binary search.
_.sortedIndex = function(array, obj, iterator) {
iterator || (iterator = _.identity);
var low = 0, high = array.length;
while (low < high) {
var mid = (low + high) >> 1;
iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
}
return low;
};
// Safely convert anything iterable into a real, live array.
_.toArray = function(iterable) {
if (!iterable) return [];
if (iterable.toArray) return iterable.toArray();
if (_.isArray(iterable)) return slice.call(iterable);
if (_.isArguments(iterable)) return slice.call(iterable);
return _.values(iterable);
};
// Return the number of elements in an object.
_.size = function(obj) {
return _.toArray(obj).length;
};
// Array Functions
// ---------------
// Get the first element of an array. Passing **n** will return the first N
// values in the array. Aliased as `head`. The **guard** check allows it to work
// with `_.map`.
_.first = _.head = function(array, n, guard) {
return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
};
// Returns everything but the last entry of the array. Especcialy useful on
// the arguments object. Passing **n** will return all the values in
// the array, excluding the last N. The **guard** check allows it to work with
// `_.map`.
_.initial = function(array, n, guard) {
return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
};
// Get the last element of an array. Passing **n** will return the last N
// values in the array. The **guard** check allows it to work with `_.map`.
_.last = function(array, n, guard) {
if ((n != null) && !guard) {
return slice.call(array, Math.max(array.length - n, 0));
} else {
return array[array.length - 1];
}
};
// Returns everything but the first entry of the array. Aliased as `tail`.
// Especially useful on the arguments object. Passing an **index** will return
// the rest of the values in the array from that index onward. The **guard**
// check allows it to work with `_.map`.
_.rest = _.tail = function(array, index, guard) {
return slice.call(array, (index == null) || guard ? 1 : index);
};
// Trim out all falsy values from an array.
_.compact = function(array) {
return _.filter(array, function(value){ return !!value; });
};
// Return a completely flattened version of an array.
_.flatten = function(array, shallow) {
return _.reduce(array, function(memo, value) {
if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));
memo[memo.length] = value;
return memo;
}, []);
};
// Return a version of the array that does not contain the specified value(s).
_.without = function(array) {
return _.difference(array, slice.call(arguments, 1));
};
// Produce a duplicate-free version of the array. If the array has already
// been sorted, you have the option of using a faster algorithm.
// Aliased as `unique`.
_.uniq = _.unique = function(array, isSorted, iterator) {
var initial = iterator ? _.map(array, iterator) : array;
var result = [];
_.reduce(initial, function(memo, el, i) {
if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) {
memo[memo.length] = el;
result[result.length] = array[i];
}
return memo;
}, []);
return result;
};
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
_.union = function() {
return _.uniq(_.flatten(arguments, true));
};
// Produce an array that contains every item shared between all the
// passed-in arrays. (Aliased as "intersect" for back-compat.)
_.intersection = _.intersect = function(array) {
var rest = slice.call(arguments, 1);
return _.filter(_.uniq(array), function(item) {
return _.every(rest, function(other) {
return _.indexOf(other, item) >= 0;
});
});
};
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
_.difference = function(array) {
var rest = _.flatten(slice.call(arguments, 1));
return _.filter(array, function(value){ return !_.include(rest, value); });
};
// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function() {
var args = slice.call(arguments);
var length = _.max(_.pluck(args, 'length'));
var results = new Array(length);
for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
return results;
};
// If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
// we need this function. Return the position of the first occurrence of an
// item in an array, or -1 if the item is not included in the array.
// Delegates to **ECMAScript 5**'s native `indexOf` if available.
// If the array is large and already in sort order, pass `true`
// for **isSorted** to use binary search.
_.indexOf = function(array, item, isSorted) {
if (array == null) return -1;
var i, l;
if (isSorted) {
i = _.sortedIndex(array, item);
return array[i] === item ? i : -1;
}
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;
return -1;
};
// Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
_.lastIndexOf = function(array, item) {
if (array == null) return -1;
if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);
var i = array.length;
while (i--) if (i in array && array[i] === item) return i;
return -1;
};
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](http://docs.python.org/library/functions.html#range).
_.range = function(start, stop, step) {
if (arguments.length <= 1) {
stop = start || 0;
start = 0;
}
step = arguments[2] || 1;
var len = Math.max(Math.ceil((stop - start) / step), 0);
var idx = 0;
var range = new Array(len);
while(idx < len) {
range[idx++] = start;
start += step;
}
return range;
};
// Function (ahem) Functions
// ------------------
// Reusable constructor function for prototype setting.
var ctor = function(){};
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally). Binding with arguments is also known as `curry`.
// Delegates to **ECMAScript 5**'s native `Function.bind` if available.
// We check for `func.bind` first, to fail fast when `func` is undefined.
_.bind = function bind(func, context) {
var bound, args;
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError;
args = slice.call(arguments, 2);
return bound = function() {
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
ctor.prototype = func.prototype;
var self = new ctor;
var result = func.apply(self, args.concat(slice.call(arguments)));
if (Object(result) === result) return result;
return self;
};
};
// Bind all of an object's methods to that object. Useful for ensuring that
// all callbacks defined on an object belong to it.
_.bindAll = function(obj) {
var funcs = slice.call(arguments, 1);
if (funcs.length == 0) funcs = _.functions(obj);
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
return obj;
};
// Memoize an expensive function by storing its results.
_.memoize = function(func, hasher) {
var memo = {};
hasher || (hasher = _.identity);
return function() {
var key = hasher.apply(this, arguments);
return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
};
};
// Delays a function for the given number of milliseconds, and then calls
// it with the arguments supplied.
_.delay = function(func, wait) {
var args = slice.call(arguments, 2);
return setTimeout(function(){ return func.apply(func, args); }, wait);
};
// Defers a function, scheduling it to run after the current call stack has
// cleared.
_.defer = function(func) {
return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
};
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time.
_.throttle = function(func, wait) {
var context, args, timeout, throttling, more;
var whenDone = _.debounce(function(){ more = throttling = false; }, wait);
return function() {
context = this; args = arguments;
var later = function() {
timeout = null;
if (more) func.apply(context, args);
whenDone();
};
if (!timeout) timeout = setTimeout(later, wait);
if (throttling) {
more = true;
} else {
func.apply(context, args);
}
whenDone();
throttling = true;
};
};
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds.
_.debounce = function(func, wait) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
func.apply(context, args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
};
// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
_.once = function(func) {
var ran = false, memo;
return function() {
if (ran) return memo;
ran = true;
return memo = func.apply(this, arguments);
};
};
// Returns the first function passed as an argument to the second,
// allowing you to adjust arguments, run code before and after, and
// conditionally execute the original function.
_.wrap = function(func, wrapper) {
return function() {
var args = [func].concat(slice.call(arguments, 0));
return wrapper.apply(this, args);
};
};
// Returns a function that is the composition of a list of functions, each
// consuming the return value of the function that follows.
_.compose = function() {
var funcs = arguments;
return function() {
var args = arguments;
for (var i = funcs.length - 1; i >= 0; i--) {
args = [funcs[i].apply(this, args)];
}
return args[0];
};
};
// Returns a function that will only be executed after being called N times.
_.after = function(times, func) {
if (times <= 0) return func();
return function() {
if (--times < 1) { return func.apply(this, arguments); }
};
};
// Object Functions
// ----------------
// Retrieve the names of an object's properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
_.keys = nativeKeys || function(obj) {
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
return keys;
};
// Retrieve the values of an object's properties.
_.values = function(obj) {
return _.map(obj, _.identity);
};
// Return a sorted list of the function names available on the object.
// Aliased as `methods`
_.functions = _.methods = function(obj) {
var names = [];
for (var key in obj) {
if (_.isFunction(obj[key])) names.push(key);
}
return names.sort();
};
// Extend a given object with all the properties in passed-in object(s).
_.extend = function(obj) {
each(slice.call(arguments, 1), function(source) {
for (var prop in source) {
obj[prop] = source[prop];
}
});
return obj;
};
// Fill in a given object with default properties.
_.defaults = function(obj) {
each(slice.call(arguments, 1), function(source) {
for (var prop in source) {
if (obj[prop] == null) obj[prop] = source[prop];
}
});
return obj;
};
// Create a (shallow-cloned) duplicate of an object.
_.clone = function(obj) {
if (!_.isObject(obj)) return obj;
return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
};
// Invokes interceptor with the obj, and then returns obj.
// The primary purpose of this method is to "tap into" a method chain, in
// order to perform operations on intermediate results within the chain.
_.tap = function(obj, interceptor) {
interceptor(obj);
return obj;
};
// Internal recursive comparison function.
function eq(a, b, stack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a._chain) a = a._wrapped;
if (b._chain) b = b._wrapped;
// Invoke a custom `isEqual` method if one is provided.
if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b);
if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a);
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className != toString.call(b)) return false;
switch (className) {
// Strings, numbers, dates, and booleans are compared by value.
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case '[object Number]':
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
// other numeric values.
return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a == +b;
// RegExps are compared by their source patterns and flags.
case '[object RegExp]':
return a.source == b.source &&
a.global == b.global &&
a.multiline == b.multiline &&
a.ignoreCase == b.ignoreCase;
}
if (typeof a != 'object' || typeof b != 'object') return false;
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var length = stack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (stack[length] == a) return true;
}
// Add the first object to the stack of traversed objects.
stack.push(a);
var size = 0, result = true;
// Recursively compare objects and arrays.
if (className == '[object Array]') {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size == b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
// Ensure commutative equality for sparse arrays.
if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break;
}
}
} else {
// Objects with different constructors are not equivalent.
if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;
// Deep compare objects.
for (var key in a) {
if (_.has(a, key)) {
// Count the expected number of properties.
size++;
// Deep compare each member.
if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;
}
}
// Ensure that both objects contain the same number of properties.
if (result) {
for (key in b) {
if (_.has(b, key) && !(size--)) break;
}
result = !size;
}
}
// Remove the first object from the stack of traversed objects.
stack.pop();
return result;
}
// Perform a deep comparison to check if two objects are equal.
_.isEqual = function(a, b) {
return eq(a, b, []);
};
// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
_.isEmpty = function(obj) {
if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
for (var key in obj) if (_.has(obj, key)) return false;
return true;
};
// Is a given value a DOM element?
_.isElement = function(obj) {
return !!(obj && obj.nodeType == 1);
};
// Is a given value an array?
// Delegates to ECMA5's native Array.isArray
_.isArray = nativeIsArray || function(obj) {
return toString.call(obj) == '[object Array]';
};
// Is a given variable an object?
_.isObject = function(obj) {
return obj === Object(obj);
};
// Is a given variable an arguments object?
_.isArguments = function(obj) {
return toString.call(obj) == '[object Arguments]';
};
if (!_.isArguments(arguments)) {
_.isArguments = function(obj) {
return !!(obj && _.has(obj, 'callee'));
};
}
// Is a given value a function?
_.isFunction = function(obj) {
return toString.call(obj) == '[object Function]';
};
// Is a given value a string?
_.isString = function(obj) {
return toString.call(obj) == '[object String]';
};
// Is a given value a number?
_.isNumber = function(obj) {
return toString.call(obj) == '[object Number]';
};
// Is the given value `NaN`?
_.isNaN = function(obj) {
// `NaN` is the only value for which `===` is not reflexive.
return obj !== obj;
};
// Is a given value a boolean?
_.isBoolean = function(obj) {
return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
};
// Is a given value a date?
_.isDate = function(obj) {
return toString.call(obj) == '[object Date]';
};
// Is the given value a regular expression?
_.isRegExp = function(obj) {
return toString.call(obj) == '[object RegExp]';
};
// Is a given value equal to null?
_.isNull = function(obj) {
return obj === null;
};
// Is a given variable undefined?
_.isUndefined = function(obj) {
return obj === void 0;
};
// Has own property?
_.has = function(obj, key) {
return hasOwnProperty.call(obj, key);
};
// Utility Functions
// -----------------
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
// previous owner. Returns a reference to the Underscore object.
_.noConflict = function() {
root._ = previousUnderscore;
return this;
};
// Keep the identity function around for default iterators.
_.identity = function(value) {
return value;
};
// Run a function **n** times.
_.times = function (n, iterator, context) {
for (var i = 0; i < n; i++) iterator.call(context, i);
};
// Escape a string for HTML interpolation.
_.escape = function(string) {
return (''+string).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;').replace(/\//g,'&#x2F;');
};
// Add your own custom functions to the Underscore object, ensuring that
// they're correctly added to the OOP wrapper as well.
_.mixin = function(obj) {
each(_.functions(obj), function(name){
addToWrapper(name, _[name] = obj[name]);
});
};
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var idCounter = 0;
_.uniqueId = function(prefix) {
var id = idCounter++;
return prefix ? prefix + id : id;
};
// By default, Underscore uses ERB-style template delimiters, change the
// following template settings to use alternative delimiters.
_.templateSettings = {
evaluate : /<%([\s\S]+?)%>/g,
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g
};
// When customizing `templateSettings`, if you don't want to define an
// interpolation, evaluation or escaping regex, we need one that is
// guaranteed not to match.
var noMatch = /.^/;
// Within an interpolation, evaluation, or escaping, remove HTML escaping
// that had been previously added.
var unescape = function(code) {
return code.replace(/\\\\/g, '\\').replace(/\\'/g, "'");
};
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
_.template = function(str, data) {
var c = _.templateSettings;
var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
'with(obj||{}){__p.push(\'' +
str.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'")
.replace(c.escape || noMatch, function(match, code) {
return "',_.escape(" + unescape(code) + "),'";
})
.replace(c.interpolate || noMatch, function(match, code) {
return "'," + unescape(code) + ",'";
})
.replace(c.evaluate || noMatch, function(match, code) {
return "');" + unescape(code).replace(/[\r\n\t]/g, ' ') + ";__p.push('";
})
.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n')
.replace(/\t/g, '\\t')
+ "');}return __p.join('');";
var func = new Function('obj', '_', tmpl);
if (data) return func(data, _);
return function(data) {
return func.call(this, data, _);
};
};
// Add a "chain" function, which will delegate to the wrapper.
_.chain = function(obj) {
return _(obj).chain();
};
// The OOP Wrapper
// ---------------
// If Underscore is called as a function, it returns a wrapped object that
// can be used OO-style. This wrapper holds altered versions of all the
// underscore functions. Wrapped objects may be chained.
var wrapper = function(obj) { this._wrapped = obj; };
// Expose `wrapper.prototype` as `_.prototype`
_.prototype = wrapper.prototype;
// Helper function to continue chaining intermediate results.
var result = function(obj, chain) {
return chain ? _(obj).chain() : obj;
};
// A method to easily add functions to the OOP wrapper.
var addToWrapper = function(name, func) {
wrapper.prototype[name] = function() {
var args = slice.call(arguments);
unshift.call(args, this._wrapped);
return result(func.apply(_, args), this._chain);
};
};
// Add all of the Underscore functions to the wrapper object.
_.mixin(_);
// Add all mutator Array functions to the wrapper.
each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
var method = ArrayProto[name];
wrapper.prototype[name] = function() {
var wrapped = this._wrapped;
method.apply(wrapped, arguments);
var length = wrapped.length;
if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];
return result(wrapped, this._chain);
};
});
// Add all accessor Array functions to the wrapper.
each(['concat', 'join', 'slice'], function(name) {
var method = ArrayProto[name];
wrapper.prototype[name] = function() {
return result(method.apply(this._wrapped, arguments), this._chain);
};
});
// Start chaining a wrapped Underscore object.
wrapper.prototype.chain = function() {
this._chain = true;
return this;
};
// Extracts the result from a wrapped and chained object.
wrapper.prototype.value = function() {
return this._wrapped;
};
}).call(this);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 345 B

BIN
doc/_static/up.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

After

Width:  |  Height:  |  Size: 345 B

View File

@ -4,7 +4,7 @@
*
* sphinx.websupport utilties for all documentation.
*
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -50,51 +50,51 @@
}
function initEvents() {
$('a.comment-close').live("click", function(event) {
$(document).on("click", 'a.comment-close', function(event) {
event.preventDefault();
hide($(this).attr('id').substring(2));
});
$('a.vote').live("click", function(event) {
$(document).on("click", 'a.vote', function(event) {
event.preventDefault();
handleVote($(this));
});
$('a.reply').live("click", function(event) {
$(document).on("click", 'a.reply', function(event) {
event.preventDefault();
openReply($(this).attr('id').substring(2));
});
$('a.close-reply').live("click", function(event) {
$(document).on("click", 'a.close-reply', function(event) {
event.preventDefault();
closeReply($(this).attr('id').substring(2));
});
$('a.sort-option').live("click", function(event) {
$(document).on("click", 'a.sort-option', function(event) {
event.preventDefault();
handleReSort($(this));
});
$('a.show-proposal').live("click", function(event) {
$(document).on("click", 'a.show-proposal', function(event) {
event.preventDefault();
showProposal($(this).attr('id').substring(2));
});
$('a.hide-proposal').live("click", function(event) {
$(document).on("click", 'a.hide-proposal', function(event) {
event.preventDefault();
hideProposal($(this).attr('id').substring(2));
});
$('a.show-propose-change').live("click", function(event) {
$(document).on("click", 'a.show-propose-change', function(event) {
event.preventDefault();
showProposeChange($(this).attr('id').substring(2));
});
$('a.hide-propose-change').live("click", function(event) {
$(document).on("click", 'a.hide-propose-change', function(event) {
event.preventDefault();
hideProposeChange($(this).attr('id').substring(2));
});
$('a.accept-comment').live("click", function(event) {
$(document).on("click", 'a.accept-comment', function(event) {
event.preventDefault();
acceptComment($(this).attr('id').substring(2));
});
$('a.delete-comment').live("click", function(event) {
$(document).on("click", 'a.delete-comment', function(event) {
event.preventDefault();
deleteComment($(this).attr('id').substring(2));
});
$('a.comment-markup').live("click", function(event) {
$(document).on("click", 'a.comment-markup', function(event) {
event.preventDefault();
toggleCommentMarkupBox($(this).attr('id').substring(2));
});
@ -700,8 +700,8 @@
(<a href="#" class="comment-markup" id="ab<%id%>">markup</a>):</p>\
<div class="comment-markup-box" id="mb<%id%>">\
reStructured text markup: <i>*emph*</i>, <b>**strong**</b>, \
<tt>``code``</tt>, \
code blocks: <tt>::</tt> and an indented block after blank line</div>\
<code>``code``</code>, \
code blocks: <code>::</code> and an indented block after blank line</div>\
<form method="post" id="cf<%id%>" class="comment-form" action="">\
<textarea name="comment" cols="80"></textarea>\
<p class="propose-button">\

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Authors &mdash; Eventlet 0.16.1 documentation</title>
<title>Authors &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="History" href="history.html" />
<link rel="prev" title="eventlet.green.zmq ØMQ support" href="modules/zmq.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,14 +43,14 @@
<li class="right" >
<a href="modules/zmq.html" title="eventlet.green.zmq ØMQ support"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="authors">
<h1>Authors<a class="headerlink" href="#authors" title="Permalink to this headline"></a></h1>
@ -96,6 +96,7 @@
<li>Jakub Stasiak</li>
<li>Aldona Majorek</li>
<li>Victor Sergeyev</li>
<li>David Szotten</li>
</ul>
</div>
<div class="section" id="linden-lab-contributors">
@ -159,7 +160,7 @@
<li>Astrum Kuo, python3 compatibility fixes; greenthread.unlink() method</li>
<li>Davanum Srinivas, Python3 compatibility fixes</li>
<li>Dmitriy Kruglyak, PyPy 2.3 compatibility fix</li>
<li>Jan Grant, Michael Kerrin, second simultaneous read (Github #94)</li>
<li>Jan Grant, Michael Kerrin, second simultaneous read (GH-94)</li>
<li>Simon Jagoe, Python3 octal literal fix</li>
<li>Tushar Gohad, wsgi: Support optional headers w/ &#8220;100 Continue&#8221; responses</li>
<li>raylu, fixing operator precedence bug in eventlet.wsgi</li>
@ -174,6 +175,13 @@
<li>Stuart McLaren</li>
<li>Tomaz Muraus</li>
<li>Victor Stinner</li>
<li>ChangBo Guo(gcb), fixing typos in the documentation (GH-194)</li>
<li>Marc Abramowitz, fixing the README so it renders correctly on PyPI (GH-183)</li>
<li>Shaun Stanworth, equal chance to acquire semaphore from different greenthreads (GH-136)</li>
<li>Lior Neudorfer, Make sure SSL retries are done using the exact same data buffer</li>
<li>Sean Dague, wsgi: Provide python logging compatibility</li>
<li>Tim Simmons, Use _socket_nodns and select in dnspython support</li>
<li>Antonio Cuni, fix fd double close on PyPy</li>
</ul>
</div>
</div>
@ -182,7 +190,7 @@
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
@ -198,16 +206,18 @@
<h4>Previous topic</h4>
<p class="topless"><a href="modules/zmq.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">eventlet.green.zmq</span></tt> &#8211; ØMQ support</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">eventlet.green.zmq</span></code> &#8211; ØMQ support</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="history.html"
title="next chapter">History</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/authors.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/authors.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -224,7 +234,7 @@
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -239,13 +249,13 @@
<li class="right" >
<a href="modules/zmq.html" title="eventlet.green.zmq ØMQ support"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Basic Usage &mdash; Eventlet 0.16.1 documentation</title>
<title>Basic Usage &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="Design Patterns" href="design_patterns.html" />
<link rel="prev" title="Eventlet Documentation" href="index.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,18 +43,18 @@
<li class="right" >
<a href="index.html" title="Eventlet Documentation"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="basic-usage">
<h1>Basic Usage<a class="headerlink" href="#basic-usage" title="Permalink to this headline"></a></h1>
<p>If it&#8217;s your first time to Eventlet, you may find the illuminated examples in the <a class="reference internal" href="design_patterns.html#design-patterns"><em>Design Patterns</em></a> document to be a good starting point.</p>
<p>If it&#8217;s your first time to Eventlet, you may find the illuminated examples in the <a class="reference internal" href="design_patterns.html#design-patterns"><span>Design Patterns</span></a> document to be a good starting point.</p>
<p>Eventlet is built around the concept of green threads (i.e. coroutines, we use the terms interchangeably) that are launched to do network-related work. Green threads differ from normal threads in two main ways:</p>
<ul class="simple">
<li>Green threads are so cheap they are nearly free. You do not have to conserve green threads like you would normal threads. In general, there will be at least one green thread per network connection.</li>
@ -64,25 +64,25 @@
<div class="section" id="primary-api">
<h1>Primary API<a class="headerlink" href="#primary-api" title="Permalink to this headline"></a></h1>
<p>The design goal for Eventlet&#8217;s API is simplicity and readability. You should be able to read its code and understand what it&#8217;s doing. Fewer lines of code are preferred over excessively clever implementations. <a class="reference external" href="http://www.python.org/dev/peps/pep-0020/">Like Python itself</a>, there should be one, and only one obvious way to do it in Eventlet!</p>
<p>Though Eventlet has many modules, much of the most-used stuff is accessible simply by doing <tt class="docutils literal"><span class="pre">import</span> <span class="pre">eventlet</span></tt>. Here&#8217;s a quick summary of the functionality available in the <tt class="docutils literal"><span class="pre">eventlet</span></tt> module, with links to more verbose documentation on each.</p>
<p>Though Eventlet has many modules, much of the most-used stuff is accessible simply by doing <code class="docutils literal"><span class="pre">import</span> <span class="pre">eventlet</span></code>. Here&#8217;s a quick summary of the functionality available in the <code class="docutils literal"><span class="pre">eventlet</span></code> module, with links to more verbose documentation on each.</p>
<div class="section" id="greenthread-spawn">
<h2>Greenthread Spawn<a class="headerlink" href="#greenthread-spawn" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="eventlet.spawn">
<tt class="descclassname">eventlet.</tt><tt class="descname">spawn</tt><big>(</big><em>func</em>, <em>*args</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#eventlet.spawn" title="Permalink to this definition"></a></dt>
<dd><p>This launches a greenthread to call <em>func</em>. Spawning off multiple greenthreads gets work done in parallel. The return value from <tt class="docutils literal"><span class="pre">spawn</span></tt> is a <tt class="xref py py-class docutils literal"><span class="pre">greenthread.GreenThread</span></tt> object, which can be used to retrieve the return value of <em>func</em>. See <a class="reference internal" href="modules/greenthread.html#eventlet.greenthread.spawn" title="eventlet.greenthread.spawn"><tt class="xref py py-func docutils literal"><span class="pre">spawn</span></tt></a> for more details.</p>
<code class="descclassname">eventlet.</code><code class="descname">spawn</code><span class="sig-paren">(</span><em>func</em>, <em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.spawn" title="Permalink to this definition"></a></dt>
<dd><p>This launches a greenthread to call <em>func</em>. Spawning off multiple greenthreads gets work done in parallel. The return value from <code class="docutils literal"><span class="pre">spawn</span></code> is a <code class="xref py py-class docutils literal"><span class="pre">greenthread.GreenThread</span></code> object, which can be used to retrieve the return value of <em>func</em>. See <a class="reference internal" href="modules/greenthread.html#eventlet.greenthread.spawn" title="eventlet.greenthread.spawn"><code class="xref py py-func docutils literal"><span class="pre">spawn</span></code></a> for more details.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.spawn_n">
<tt class="descclassname">eventlet.</tt><tt class="descname">spawn_n</tt><big>(</big><em>func</em>, <em>*args</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#eventlet.spawn_n" title="Permalink to this definition"></a></dt>
<dd><p>The same as <tt class="xref py py-func docutils literal"><span class="pre">spawn()</span></tt>, but it&#8217;s not possible to know how the function terminated (i.e. no return value or exceptions). This makes execution faster. See <a class="reference internal" href="modules/greenthread.html#eventlet.greenthread.spawn_n" title="eventlet.greenthread.spawn_n"><tt class="xref py py-func docutils literal"><span class="pre">spawn_n</span></tt></a> for more details.</p>
<code class="descclassname">eventlet.</code><code class="descname">spawn_n</code><span class="sig-paren">(</span><em>func</em>, <em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.spawn_n" title="Permalink to this definition"></a></dt>
<dd><p>The same as <code class="xref py py-func docutils literal"><span class="pre">spawn()</span></code>, but it&#8217;s not possible to know how the function terminated (i.e. no return value or exceptions). This makes execution faster. See <a class="reference internal" href="modules/greenthread.html#eventlet.greenthread.spawn_n" title="eventlet.greenthread.spawn_n"><code class="xref py py-func docutils literal"><span class="pre">spawn_n</span></code></a> for more details.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.spawn_after">
<tt class="descclassname">eventlet.</tt><tt class="descname">spawn_after</tt><big>(</big><em>seconds</em>, <em>func</em>, <em>*args</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#eventlet.spawn_after" title="Permalink to this definition"></a></dt>
<dd><p>Spawns <em>func</em> after <em>seconds</em> have elapsed; a delayed version of <tt class="xref py py-func docutils literal"><span class="pre">spawn()</span></tt>. To abort the spawn and prevent <em>func</em> from being called, call <tt class="xref py py-meth docutils literal"><span class="pre">GreenThread.cancel()</span></tt> on the return value of <tt class="xref py py-func docutils literal"><span class="pre">spawn_after()</span></tt>. See <a class="reference internal" href="modules/greenthread.html#eventlet.greenthread.spawn_after" title="eventlet.greenthread.spawn_after"><tt class="xref py py-func docutils literal"><span class="pre">spawn_after</span></tt></a> for more details.</p>
<code class="descclassname">eventlet.</code><code class="descname">spawn_after</code><span class="sig-paren">(</span><em>seconds</em>, <em>func</em>, <em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.spawn_after" title="Permalink to this definition"></a></dt>
<dd><p>Spawns <em>func</em> after <em>seconds</em> have elapsed; a delayed version of <code class="xref py py-func docutils literal"><span class="pre">spawn()</span></code>. To abort the spawn and prevent <em>func</em> from being called, call <code class="xref py py-meth docutils literal"><span class="pre">GreenThread.cancel()</span></code> on the return value of <code class="xref py py-func docutils literal"><span class="pre">spawn_after()</span></code>. See <a class="reference internal" href="modules/greenthread.html#eventlet.greenthread.spawn_after" title="eventlet.greenthread.spawn_after"><code class="xref py py-func docutils literal"><span class="pre">spawn_after</span></code></a> for more details.</p>
</dd></dl>
</div>
@ -90,34 +90,34 @@
<h2>Greenthread Control<a class="headerlink" href="#greenthread-control" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="eventlet.sleep">
<tt class="descclassname">eventlet.</tt><tt class="descname">sleep</tt><big>(</big><em>seconds=0</em><big>)</big><a class="headerlink" href="#eventlet.sleep" title="Permalink to this definition"></a></dt>
<dd><p>Suspends the current greenthread and allows others a chance to process. See <a class="reference internal" href="modules/greenthread.html#eventlet.greenthread.sleep" title="eventlet.greenthread.sleep"><tt class="xref py py-func docutils literal"><span class="pre">sleep</span></tt></a> for more details.</p>
<code class="descclassname">eventlet.</code><code class="descname">sleep</code><span class="sig-paren">(</span><em>seconds=0</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.sleep" title="Permalink to this definition"></a></dt>
<dd><p>Suspends the current greenthread and allows others a chance to process. See <a class="reference internal" href="modules/greenthread.html#eventlet.greenthread.sleep" title="eventlet.greenthread.sleep"><code class="xref py py-func docutils literal"><span class="pre">sleep</span></code></a> for more details.</p>
</dd></dl>
<dl class="class">
<dt id="eventlet.GreenPool">
<em class="property">class </em><tt class="descclassname">eventlet.</tt><tt class="descname">GreenPool</tt><a class="headerlink" href="#eventlet.GreenPool" title="Permalink to this definition"></a></dt>
<dd><p>Pools control concurrency. It&#8217;s very common in applications to want to consume only a finite amount of memory, or to restrict the amount of connections that one part of the code holds open so as to leave more for the rest, or to behave consistently in the face of unpredictable input data. GreenPools provide this control. See <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool" title="eventlet.greenpool.GreenPool"><tt class="xref py py-class docutils literal"><span class="pre">GreenPool</span></tt></a> for more on how to use these.</p>
<em class="property">class </em><code class="descclassname">eventlet.</code><code class="descname">GreenPool</code><a class="headerlink" href="#eventlet.GreenPool" title="Permalink to this definition"></a></dt>
<dd><p>Pools control concurrency. It&#8217;s very common in applications to want to consume only a finite amount of memory, or to restrict the amount of connections that one part of the code holds open so as to leave more for the rest, or to behave consistently in the face of unpredictable input data. GreenPools provide this control. See <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool" title="eventlet.greenpool.GreenPool"><code class="xref py py-class docutils literal"><span class="pre">GreenPool</span></code></a> for more on how to use these.</p>
</dd></dl>
<dl class="class">
<dt id="eventlet.GreenPile">
<em class="property">class </em><tt class="descclassname">eventlet.</tt><tt class="descname">GreenPile</tt><a class="headerlink" href="#eventlet.GreenPile" title="Permalink to this definition"></a></dt>
<dd><p>GreenPile objects represent chunks of work. In essence a GreenPile is an iterator that can be stuffed with work, and the results read out later. See <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPile" title="eventlet.greenpool.GreenPile"><tt class="xref py py-class docutils literal"><span class="pre">GreenPile</span></tt></a> for more details.</p>
<em class="property">class </em><code class="descclassname">eventlet.</code><code class="descname">GreenPile</code><a class="headerlink" href="#eventlet.GreenPile" title="Permalink to this definition"></a></dt>
<dd><p>GreenPile objects represent chunks of work. In essence a GreenPile is an iterator that can be stuffed with work, and the results read out later. See <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPile" title="eventlet.greenpool.GreenPile"><code class="xref py py-class docutils literal"><span class="pre">GreenPile</span></code></a> for more details.</p>
</dd></dl>
<dl class="class">
<dt id="eventlet.Queue">
<em class="property">class </em><tt class="descclassname">eventlet.</tt><tt class="descname">Queue</tt><a class="headerlink" href="#eventlet.Queue" title="Permalink to this definition"></a></dt>
<dd><p>Queues are a fundamental construct for communicating data between execution units. Eventlet&#8217;s Queue class is used to communicate between greenthreads, and provides a bunch of useful features for doing that. See <a class="reference internal" href="modules/queue.html#eventlet.queue.Queue" title="eventlet.queue.Queue"><tt class="xref py py-class docutils literal"><span class="pre">Queue</span></tt></a> for more details.</p>
<em class="property">class </em><code class="descclassname">eventlet.</code><code class="descname">Queue</code><a class="headerlink" href="#eventlet.Queue" title="Permalink to this definition"></a></dt>
<dd><p>Queues are a fundamental construct for communicating data between execution units. Eventlet&#8217;s Queue class is used to communicate between greenthreads, and provides a bunch of useful features for doing that. See <a class="reference internal" href="modules/queue.html#eventlet.queue.Queue" title="eventlet.queue.Queue"><code class="xref py py-class docutils literal"><span class="pre">Queue</span></code></a> for more details.</p>
</dd></dl>
<dl class="class">
<dt id="eventlet.Timeout">
<em class="property">class </em><tt class="descclassname">eventlet.</tt><tt class="descname">Timeout</tt><a class="headerlink" href="#eventlet.Timeout" title="Permalink to this definition"></a></dt>
<dd><p>This class is a way to add timeouts to anything. It raises <em>exception</em> in the current greenthread after <em>timeout</em> seconds. When <em>exception</em> is omitted or <tt class="docutils literal"><span class="pre">None</span></tt>, the Timeout instance itself is raised.</p>
<em class="property">class </em><code class="descclassname">eventlet.</code><code class="descname">Timeout</code><a class="headerlink" href="#eventlet.Timeout" title="Permalink to this definition"></a></dt>
<dd><p>This class is a way to add timeouts to anything. It raises <em>exception</em> in the current greenthread after <em>timeout</em> seconds. When <em>exception</em> is omitted or <code class="docutils literal"><span class="pre">None</span></code>, the Timeout instance itself is raised.</p>
<p>Timeout objects are context managers, and so can be used in with statements.
See <a class="reference internal" href="modules/timeout.html#eventlet.timeout.Timeout" title="eventlet.timeout.Timeout"><tt class="xref py py-class docutils literal"><span class="pre">Timeout</span></tt></a> for more details.</p>
See <a class="reference internal" href="modules/timeout.html#eventlet.timeout.Timeout" title="eventlet.timeout.Timeout"><code class="xref py py-class docutils literal"><span class="pre">Timeout</span></code></a> for more details.</p>
</dd></dl>
</div>
@ -125,14 +125,14 @@ See <a class="reference internal" href="modules/timeout.html#eventlet.timeout.Ti
<h2>Patching Functions<a class="headerlink" href="#patching-functions" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="eventlet.import_patched">
<tt class="descclassname">eventlet.</tt><tt class="descname">import_patched</tt><big>(</big><em>modulename</em>, <em>*additional_modules</em>, <em>**kw_additional_modules</em><big>)</big><a class="headerlink" href="#eventlet.import_patched" title="Permalink to this definition"></a></dt>
<dd><p>Imports a module in a way that ensures that the module uses &#8220;green&#8221; versions of the standard library modules, so that everything works nonblockingly. The only required argument is the name of the module to be imported. For more information see <a class="reference internal" href="patching.html#import-green"><em>Import Green</em></a>.</p>
<code class="descclassname">eventlet.</code><code class="descname">import_patched</code><span class="sig-paren">(</span><em>modulename</em>, <em>*additional_modules</em>, <em>**kw_additional_modules</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.import_patched" title="Permalink to this definition"></a></dt>
<dd><p>Imports a module in a way that ensures that the module uses &#8220;green&#8221; versions of the standard library modules, so that everything works nonblockingly. The only required argument is the name of the module to be imported. For more information see <a class="reference internal" href="patching.html#import-green"><span>Import Green</span></a>.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.monkey_patch">
<tt class="descclassname">eventlet.</tt><tt class="descname">monkey_patch</tt><big>(</big><em>all=True</em>, <em>os=False</em>, <em>select=False</em>, <em>socket=False</em>, <em>thread=False</em>, <em>time=False</em><big>)</big><a class="headerlink" href="#eventlet.monkey_patch" title="Permalink to this definition"></a></dt>
<dd><p>Globally patches certain system modules to be greenthread-friendly. The keyword arguments afford some control over which modules are patched. If <em>all</em> is True, then all modules are patched regardless of the other arguments. If it&#8217;s False, then the rest of the keyword arguments control patching of specific subsections of the standard library. Most patch the single module of the same name (os, time, select). The exceptions are socket, which also patches the ssl module if present; and thread, which patches thread, threading, and Queue. It&#8217;s safe to call monkey_patch multiple times. For more information see <a class="reference internal" href="patching.html#monkey-patch"><em>Monkeypatching the Standard Library</em></a>.</p>
<code class="descclassname">eventlet.</code><code class="descname">monkey_patch</code><span class="sig-paren">(</span><em>all=True</em>, <em>os=False</em>, <em>select=False</em>, <em>socket=False</em>, <em>thread=False</em>, <em>time=False</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.monkey_patch" title="Permalink to this definition"></a></dt>
<dd><p>Globally patches certain system modules to be greenthread-friendly. The keyword arguments afford some control over which modules are patched. If <em>all</em> is True, then all modules are patched regardless of the other arguments. If it&#8217;s False, then the rest of the keyword arguments control patching of specific subsections of the standard library. Most patch the single module of the same name (os, time, select). The exceptions are socket, which also patches the ssl module if present; and thread, which patches thread, threading, and Queue. It&#8217;s safe to call monkey_patch multiple times. For more information see <a class="reference internal" href="patching.html#monkey-patch"><span>Monkeypatching the Standard Library</span></a>.</p>
</dd></dl>
</div>
@ -140,7 +140,7 @@ See <a class="reference internal" href="modules/timeout.html#eventlet.timeout.Ti
<h2>Network Convenience Functions<a class="headerlink" href="#network-convenience-functions" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="eventlet.connect">
<tt class="descclassname">eventlet.</tt><tt class="descname">connect</tt><big>(</big><em>addr</em>, <em>family=2</em>, <em>bind=None</em><big>)</big><a class="headerlink" href="#eventlet.connect" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.</code><code class="descname">connect</code><span class="sig-paren">(</span><em>addr</em>, <em>family=&lt;AddressFamily.AF_INET: 2&gt;</em>, <em>bind=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.connect" title="Permalink to this definition"></a></dt>
<dd><p>Convenience function for opening client sockets.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@ -148,7 +148,7 @@ See <a class="reference internal" href="modules/timeout.html#eventlet.timeout.Ti
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>addr</strong> &#8211; Address of the server to connect to. For TCP sockets, this is a (host, port) tuple.</li>
<li><strong>family</strong> &#8211; Socket family, optional. See <a class="reference external" href="http://docs.python.org/library/socket.html#module-socket" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">socket</span></tt></a> documentation for available families.</li>
<li><strong>family</strong> &#8211; Socket family, optional. See <a class="reference external" href="http://docs.python.org/library/socket.html#module-socket" title="(in Python v2.7)"><code class="xref py py-mod docutils literal"><span class="pre">socket</span></code></a> documentation for available families.</li>
<li><strong>bind</strong> &#8211; Local address to bind to, optional.</li>
</ul>
</td>
@ -162,9 +162,9 @@ See <a class="reference internal" href="modules/timeout.html#eventlet.timeout.Ti
<dl class="function">
<dt id="eventlet.listen">
<tt class="descclassname">eventlet.</tt><tt class="descname">listen</tt><big>(</big><em>addr</em>, <em>family=2</em>, <em>backlog=50</em><big>)</big><a class="headerlink" href="#eventlet.listen" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.</code><code class="descname">listen</code><span class="sig-paren">(</span><em>addr</em>, <em>family=&lt;AddressFamily.AF_INET: 2&gt;</em>, <em>backlog=50</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.listen" title="Permalink to this definition"></a></dt>
<dd><p>Convenience function for opening server sockets. This
socket can be used in <a class="reference internal" href="#eventlet.serve" title="eventlet.serve"><tt class="xref py py-func docutils literal"><span class="pre">serve()</span></tt></a> or a custom <tt class="docutils literal"><span class="pre">accept()</span></tt> loop.</p>
socket can be used in <a class="reference internal" href="#eventlet.serve" title="eventlet.serve"><code class="xref py py-func docutils literal"><span class="pre">serve()</span></code></a> or a custom <code class="docutils literal"><span class="pre">accept()</span></code> loop.</p>
<p>Sets SO_REUSEADDR on the socket to save on annoyance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@ -172,7 +172,7 @@ socket can be used in <a class="reference internal" href="#eventlet.serve" title
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>addr</strong> &#8211; Address to listen on. For TCP sockets, this is a (host, port) tuple.</li>
<li><strong>family</strong> &#8211; Socket family, optional. See <a class="reference external" href="http://docs.python.org/library/socket.html#module-socket" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">socket</span></tt></a> documentation for available families.</li>
<li><strong>family</strong> &#8211; Socket family, optional. See <a class="reference external" href="http://docs.python.org/library/socket.html#module-socket" title="(in Python v2.7)"><code class="xref py py-mod docutils literal"><span class="pre">socket</span></code></a> documentation for available families.</li>
<li><strong>backlog</strong> &#8211; The maximum number of queued connections. Should be at least 1; the maximum
value is system-dependent.</li>
</ul>
@ -187,15 +187,15 @@ value is system-dependent.</li>
<dl class="function">
<dt id="eventlet.wrap_ssl">
<tt class="descclassname">eventlet.</tt><tt class="descname">wrap_ssl</tt><big>(</big><em>sock</em>, <em>*a</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#eventlet.wrap_ssl" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.</code><code class="descname">wrap_ssl</code><span class="sig-paren">(</span><em>sock</em>, <em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.wrap_ssl" title="Permalink to this definition"></a></dt>
<dd><p>Convenience function for converting a regular socket into an
SSL socket. Has the same interface as <a class="reference external" href="http://docs.python.org/library/ssl.html#ssl.wrap_socket" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">ssl.wrap_socket()</span></tt></a>,
SSL socket. Has the same interface as <a class="reference external" href="http://docs.python.org/library/ssl.html#ssl.wrap_socket" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">ssl.wrap_socket()</span></code></a>,
but can also use PyOpenSSL. Though, note that it ignores the
<cite>cert_reqs</cite>, <cite>ssl_version</cite>, <cite>ca_certs</cite>, <cite>do_handshake_on_connect</cite>,
and <cite>suppress_ragged_eofs</cite> arguments when using PyOpenSSL.</p>
<p>The preferred idiom is to call wrap_ssl directly on the creation
method, e.g., <tt class="docutils literal"><span class="pre">wrap_ssl(connect(addr))</span></tt> or
<tt class="docutils literal"><span class="pre">wrap_ssl(listen(addr),</span> <span class="pre">server_side=True)</span></tt>. This way there is
method, e.g., <code class="docutils literal"><span class="pre">wrap_ssl(connect(addr))</span></code> or
<code class="docutils literal"><span class="pre">wrap_ssl(listen(addr),</span> <span class="pre">server_side=True)</span></code>. This way there is
no &#8220;naked&#8221; socket sitting around to accidentally corrupt the SSL
session.</p>
<p>:return Green SSL object.</p>
@ -203,7 +203,7 @@ session.</p>
<dl class="function">
<dt id="eventlet.serve">
<tt class="descclassname">eventlet.</tt><tt class="descname">serve</tt><big>(</big><em>sock</em>, <em>handle</em>, <em>concurrency=1000</em><big>)</big><a class="headerlink" href="#eventlet.serve" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.</code><code class="descname">serve</code><span class="sig-paren">(</span><em>sock</em>, <em>handle</em>, <em>concurrency=1000</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.serve" title="Permalink to this definition"></a></dt>
<dd><p>Runs a server on the supplied socket. Calls the function <em>handle</em> in a
separate greenthread for every incoming client connection. <em>handle</em> takes
two arguments: the client socket object, and the client address:</p>
@ -214,14 +214,14 @@ two arguments: the client socket object, and the client address:</p>
</pre></div>
</div>
<p>Returning from <em>handle</em> closes the client socket.</p>
<p><tt class="xref py py-func docutils literal"><span class="pre">serve()</span></tt> blocks the calling greenthread; it won&#8217;t return until
<p><code class="xref py py-func docutils literal"><span class="pre">serve()</span></code> blocks the calling greenthread; it won&#8217;t return until
the server completes. If you desire an immediate return,
spawn a new greenthread for <tt class="xref py py-func docutils literal"><span class="pre">serve()</span></tt>.</p>
spawn a new greenthread for <code class="xref py py-func docutils literal"><span class="pre">serve()</span></code>.</p>
<p>Any uncaught exceptions raised in <em>handle</em> are raised as exceptions
from <tt class="xref py py-func docutils literal"><span class="pre">serve()</span></tt>, terminating the server, so be sure to be aware of the
from <code class="xref py py-func docutils literal"><span class="pre">serve()</span></code>, terminating the server, so be sure to be aware of the
exceptions your application can raise. The return value of <em>handle</em> is
ignored.</p>
<p>Raise a <a class="reference internal" href="#eventlet.StopServe" title="eventlet.StopServe"><tt class="xref py py-class docutils literal"><span class="pre">StopServe</span></tt></a> exception to gracefully terminate the
<p>Raise a <a class="reference internal" href="#eventlet.StopServe" title="eventlet.StopServe"><code class="xref py py-class docutils literal"><span class="pre">StopServe</span></code></a> exception to gracefully terminate the
server &#8211; that&#8217;s the only way to get the server() function to return rather
than raise.</p>
<p>The value in <em>concurrency</em> controls the maximum number of
@ -232,8 +232,8 @@ connections until the existing ones complete.</p>
<dl class="class">
<dt id="eventlet.StopServe">
<em class="property">class </em><tt class="descclassname">eventlet.</tt><tt class="descname">StopServe</tt><a class="headerlink" href="#eventlet.StopServe" title="Permalink to this definition"></a></dt>
<dd><p>Exception class used for quitting <a class="reference internal" href="#eventlet.serve" title="eventlet.serve"><tt class="xref py py-func docutils literal"><span class="pre">serve()</span></tt></a> gracefully.</p>
<em class="property">class </em><code class="descclassname">eventlet.</code><code class="descname">StopServe</code><a class="headerlink" href="#eventlet.StopServe" title="Permalink to this definition"></a></dt>
<dd><p>Exception class used for quitting <a class="reference internal" href="#eventlet.serve" title="eventlet.serve"><code class="xref py py-func docutils literal"><span class="pre">serve()</span></code></a> gracefully.</p>
</dd></dl>
<p>These are the basic primitives of Eventlet; there are a lot more out there in the other Eventlet modules; check out the <a class="reference internal" href="modules.html"><em>Module Reference</em></a>.</p>
@ -244,7 +244,7 @@ connections until the existing ones complete.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
@ -264,12 +264,14 @@ connections until the existing ones complete.</p>
<h4>Next topic</h4>
<p class="topless"><a href="design_patterns.html"
title="next chapter">Design Patterns</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/basic_usage.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/basic_usage.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -286,7 +288,7 @@ connections until the existing ones complete.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -301,13 +303,13 @@ connections until the existing ones complete.</p>
<li class="right" >
<a href="index.html" title="Eventlet Documentation"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>0.16.1 &mdash; Eventlet 0.16.1 documentation</title>
<title>0.17.2 &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,10 +23,10 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -35,23 +35,51 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="id1">
<h1>0.16.1<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h1>
<h1>0.17.2<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>wsgi: Provide python logging compatibility; Thanks to Sean Dague</li>
<li>greendns: fix premature connection closing in DNS proxy; Thanks to Tim Simmons</li>
<li>greenio: correct fd close; Thanks to Antonio Cuni and Victor Sergeyev</li>
<li>green.ssl: HTTPS client Python 2.7.9+ compatibility</li>
<li>setup: tests.{isolated,manual} polluted top-level packages</li>
</ul>
</div>
<div class="section" id="id2">
<h1>0.17.1<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>greendns: fix dns.name import and Python3 compatibility</li>
</ul>
</div>
<div class="section" id="id3">
<h1>0.17<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Full Python3 compatibility; Thanks to Jakub Stasiak</li>
<li>greendns: IPv6 support, improved handling of /etc/hosts; Thanks to Floris Bruynooghe</li>
<li>tpool: make sure we return results during killall; Thanks to David Szotten</li>
<li>semaphore: Don&#8217;t hog a semaphore if someone else is waiting for it; Thanks to Shaun Stanworth</li>
<li>green.socket: create_connection() was wrapping all exceptions in socket.error; Thanks to Donagh McCabe</li>
<li>Make sure SSL retries are done using the exact same data buffer; Thanks to Lior Neudorfer</li>
<li>greenio: shutdown already closed sockets without error; Thanks to David Szotten</li>
</ul>
</div>
<div class="section" id="id4">
<h1>0.16.1<a class="headerlink" href="#id4" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Wheel build 0.16.0 incorrectly shipped removed module eventlet.util.</li>
</ul>
</div>
<div class="section" id="id2">
<h1>0.16.0<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h1>
<div class="section" id="id5">
<h1>0.16.0<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Fix SSL socket wrapping and Python 2.7.9 compatibility; Thanks to Jakub Stasiak</li>
<li>Fix monkey_patch() on Python 3; Thanks to Victor Stinner</li>
@ -67,22 +95,22 @@
<li>tests: Fix timers not cleaned up on MySQL test skips; Thanks to Corey Wright</li>
</ul>
</div>
<div class="section" id="id3">
<h1>0.15.2<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h1>
<div class="section" id="id6">
<h1>0.15.2<a class="headerlink" href="#id6" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>greenio: fixed memory leak, introduced in 0.15.1; Thanks to Michael Kerrin, Tushar Gohad</li>
<li>wsgi: Support optional headers w/ &#8220;100 Continue&#8221; responses; Thanks to Tushar Gohad</li>
</ul>
</div>
<div class="section" id="id4">
<h1>0.15.1<a class="headerlink" href="#id4" title="Permalink to this headline"></a></h1>
<div class="section" id="id7">
<h1>0.15.1<a class="headerlink" href="#id7" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>greenio: Fix second simultaneous read (parallel paramiko issue); Thanks to Jan Grant, Michael Kerrin</li>
<li>db_pool: customizable connection cleanup function; Thanks to Avery Fay</li>
</ul>
</div>
<div class="section" id="id5">
<h1>0.15<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h1>
<div class="section" id="id8">
<h1>0.15<a class="headerlink" href="#id8" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Python3 compatibility &#8211; <strong>not ready yet</strong>; Thanks to Astrum Kuo, Davanum Srinivas, Jakub Stasiak, Victor Sergeyev</li>
<li>coros: remove Actor which was deprecated in 2010-01</li>
@ -97,8 +125,8 @@
<li>wsgi: capitalize_response_headers option</li>
</ul>
</div>
<div class="section" id="id6">
<h1>0.14<a class="headerlink" href="#id6" title="Permalink to this headline"></a></h1>
<div class="section" id="id9">
<h1>0.14<a class="headerlink" href="#id9" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>wsgi: handle connection socket timeouts; Thanks to Paul Oppenheim</li>
<li>wsgi: close timed out client connections</li>
@ -110,8 +138,8 @@
<li>wsgi: configurable socket_timeout</li>
</ul>
</div>
<div class="section" id="id7">
<h1>0.13<a class="headerlink" href="#id7" title="Permalink to this headline"></a></h1>
<div class="section" id="id10">
<h1>0.13<a class="headerlink" href="#id10" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>hubs: kqueue support! Thanks to YAMAMOTO Takashi, Edward George</li>
<li>greenio: Fix AttributeError on MacOSX; Bitbucket #136; Thanks to Derk Tegeler</li>
@ -128,8 +156,8 @@
<li>doc: hubs: Point to the correct function in exception message; Thanks to Floris Bruynooghe</li>
</ul>
</div>
<div class="section" id="id8">
<h1>0.12<a class="headerlink" href="#id8" title="Permalink to this headline"></a></h1>
<div class="section" id="id11">
<h1>0.12<a class="headerlink" href="#id11" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>zmq: Fix 100% busy CPU in idle after .bind(PUB) (thanks to Geoff Salmon)</li>
<li>greenio: Fix socket.settimeout() did not switch back to blocking mode (thanks to Peter Skirko)</li>
@ -139,16 +167,16 @@
<li>tests: Support libzmq 3.0 SNDHWM option (thanks to Geoff Salmon)</li>
</ul>
</div>
<div class="section" id="id9">
<h1>0.11<a class="headerlink" href="#id9" title="Permalink to this headline"></a></h1>
<div class="section" id="id12">
<h1>0.11<a class="headerlink" href="#id12" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>ssl: Fix 100% busy CPU in socket.sendall() (thanks to Raymon Lu)</li>
<li>zmq: Return linger argument to Socket.close() (thanks to Eric Windisch)</li>
<li>tests: SSL tests were always skipped due to bug in skip_if_no_ssl decorator</li>
</ul>
</div>
<div class="section" id="id10">
<h1>0.10<a class="headerlink" href="#id10" title="Permalink to this headline"></a></h1>
<div class="section" id="id13">
<h1>0.10<a class="headerlink" href="#id13" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>greenio: Fix relative seek() (thanks to AlanP)</li>
<li>db_pool: Fix pool.put() TypeError with min_size &gt; 1 (thanks to Jessica Qi)</li>
@ -166,8 +194,8 @@
<li>greenio: Remove deprecated GreenPipe.xreadlines() method, was broken anyway</li>
</ul>
</div>
<div class="section" id="id11">
<h1>0.9.17<a class="headerlink" href="#id11" title="Permalink to this headline"></a></h1>
<div class="section" id="id14">
<h1>0.9.17<a class="headerlink" href="#id14" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>ZeroMQ support calling send and recv from multiple greenthreads (thanks to Geoff Salmon)</li>
<li>SSL: unwrap() sends data, and so it needs trampolining (#104 thanks to Brandon Rhodes)</li>
@ -183,14 +211,14 @@
<li>wsgi: Configurable maximum URL length (thanks to Tomas Sedovic)</li>
</ul>
</div>
<div class="section" id="id12">
<h1>0.9.16<a class="headerlink" href="#id12" title="Permalink to this headline"></a></h1>
<div class="section" id="id15">
<h1>0.9.16<a class="headerlink" href="#id15" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>SO_REUSEADDR now correctly set.</li>
</ul>
</div>
<div class="section" id="id13">
<h1>0.9.15<a class="headerlink" href="#id13" title="Permalink to this headline"></a></h1>
<div class="section" id="id16">
<h1>0.9.15<a class="headerlink" href="#id16" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>ZeroMQ support without an explicit hub now implemented! Thanks to Zed Shaw for the patch.</li>
<li>zmq module supports the NOBLOCK flag, thanks to rfk. (#76)</li>
@ -202,8 +230,8 @@
<li>Timeouts raised within tpool.execute are propagated back to the caller (thanks again to redbo for being the squeaky wheel)</li>
</ul>
</div>
<div class="section" id="id14">
<h1>0.9.14<a class="headerlink" href="#id14" title="Permalink to this headline"></a></h1>
<div class="section" id="id17">
<h1>0.9.14<a class="headerlink" href="#id17" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Many fixes to the ZeroMQ hub, which now requires version 2.0.10 or later. Thanks to Ben Ford.</li>
<li>ZeroMQ hub no longer depends on pollhub, and thus works on Windows (thanks, Alexey Borzenkov)</li>
@ -217,8 +245,8 @@
<li>Documentation for eventlet.green.zmq, courtesy of Ben Ford</li>
</ul>
</div>
<div class="section" id="id15">
<h1>0.9.13<a class="headerlink" href="#id15" title="Permalink to this headline"></a></h1>
<div class="section" id="id18">
<h1>0.9.13<a class="headerlink" href="#id18" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>ZeroMQ hub, and eventlet.green.zmq make supersockets green. Thanks to Ben Ford!</li>
<li>eventlet.green.MySQLdb added. It&#8217;s an interface to MySQLdb that uses tpool to make it appear nonblocking</li>
@ -237,8 +265,8 @@
<li>Removed _main_wrapper from greenthread, thanks to Ambroff adding keyword arguments to switch() in 0.3!</li>
</ul>
</div>
<div class="section" id="id16">
<h1>0.9.12<a class="headerlink" href="#id16" title="Permalink to this headline"></a></h1>
<div class="section" id="id19">
<h1>0.9.12<a class="headerlink" href="#id19" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Eventlet no longer uses the Twisted hub if Twisted is imported &#8211; you must call eventlet.hubs.use_hub(&#8216;twistedr&#8217;) if you want to use it. This prevents strange race conditions for those who want to use both Twisted and Eventlet separately.</li>
<li>Removed circular import in twistedr.py</li>
@ -251,8 +279,8 @@
<li>Adding websocket.html to tarball so that you can run the examples without checking out the source</li>
</ul>
</div>
<div class="section" id="id17">
<h1>0.9.10<a class="headerlink" href="#id17" title="Permalink to this headline"></a></h1>
<div class="section" id="id20">
<h1>0.9.10<a class="headerlink" href="#id20" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Greendns: if dnspython is installed, Eventlet will automatically use it to provide non-blocking DNS queries. Set the environment variable &#8216;EVENTLET_NO_GREENDNS&#8217; if you don&#8217;t want greendns but have dnspython installed.</li>
<li>Full test suite passes on Python 2.7.</li>
@ -265,16 +293,16 @@
<li>Tweaked Timeout class to do something sensible when True is passed to the constructor</li>
</ul>
</div>
<div class="section" id="id18">
<h1>0.9.9<a class="headerlink" href="#id18" title="Permalink to this headline"></a></h1>
<div class="section" id="id21">
<h1>0.9.9<a class="headerlink" href="#id21" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>A fix for monkeypatching on systems with psycopg version 2.0.14.</li>
<li>Improved support for chunked transfers in wsgi, plus a bunch of tests from schmir (ported from gevent by redbo)</li>
<li>A fix for the twisted hub from Favo Yang</li>
</ul>
</div>
<div class="section" id="id19">
<h1>0.9.8<a class="headerlink" href="#id19" title="Permalink to this headline"></a></h1>
<div class="section" id="id22">
<h1>0.9.8<a class="headerlink" href="#id22" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Support for psycopg2&#8217;s asynchronous mode, from Daniele Varrazzo</li>
<li>websocket module is now part of core Eventlet with 100% unit test coverage thanks to Ben Ford. See its documentation at <a class="reference external" href="http://eventlet.net/doc/modules/websocket.html">http://eventlet.net/doc/modules/websocket.html</a></li>
@ -286,8 +314,8 @@
<li>Many bug fixes, major and minor.</li>
</ul>
</div>
<div class="section" id="id20">
<h1>0.9.7<a class="headerlink" href="#id20" title="Permalink to this headline"></a></h1>
<div class="section" id="id23">
<h1>0.9.7<a class="headerlink" href="#id23" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>GreenPipe is now a context manager (thanks, quad)</li>
<li>tpool.Proxy supports iterators properly</li>
@ -297,8 +325,8 @@
<li>multitudinous improvements in Py3k compatibility from amajorek</li>
</ul>
</div>
<div class="section" id="id21">
<h1>0.9.6<a class="headerlink" href="#id21" title="Permalink to this headline"></a></h1>
<div class="section" id="id24">
<h1>0.9.6<a class="headerlink" href="#id24" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>new EVENTLET_HUB environment variable allows you to select a hub without code</li>
<li>improved GreenSocket and GreenPipe compatibility with stdlib</li>
@ -317,8 +345,8 @@
<li>new eventlet.serve convenience function for easy TCP servers</li>
</ul>
</div>
<div class="section" id="id22">
<h1>0.9.5<a class="headerlink" href="#id22" title="Permalink to this headline"></a></h1>
<div class="section" id="id25">
<h1>0.9.5<a class="headerlink" href="#id25" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>support psycopg in db_pool</li>
<li>smart patcher that does the right patching when importing without needing to understand plumbing of patched module</li>
@ -341,8 +369,8 @@
<li>new convenience functions: eventlet.connect and eventlet.listen. Thanks, Sergey!</li>
</ul>
</div>
<div class="section" id="id23">
<h1>0.9.4<a class="headerlink" href="#id23" title="Permalink to this headline"></a></h1>
<div class="section" id="id26">
<h1>0.9.4<a class="headerlink" href="#id26" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Deprecated coros.Queue and coros.Channel (use queue.Queue instead)</li>
<li>Added putting and getting methods to queue.Queue.</li>
@ -351,8 +379,8 @@
<li>Bugfixes in wsgi, greenpool</li>
</ul>
</div>
<div class="section" id="id24">
<h1>0.9.3<a class="headerlink" href="#id24" title="Permalink to this headline"></a></h1>
<div class="section" id="id27">
<h1>0.9.3<a class="headerlink" href="#id27" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Moved primary api module to __init__ from api. It shouldn&#8217;t be necessary to import eventlet.api anymore; import eventlet should do the same job.</li>
<li>Proc module deprecated in favor of greenthread</li>
@ -378,16 +406,16 @@
<li>Removed saranwrap as an option for making db connections nonblocking in db_pool.</li>
</ul>
</div>
<div class="section" id="id25">
<h1>0.9.2<a class="headerlink" href="#id25" title="Permalink to this headline"></a></h1>
<div class="section" id="id28">
<h1>0.9.2<a class="headerlink" href="#id28" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Bugfix for wsgi.py where it was improperly expecting the environ variable to be a constant when passed to the application.</li>
<li>Tpool.py now passes its tests on Windows.</li>
<li>Fixed minor performance issue in wsgi.</li>
</ul>
</div>
<div class="section" id="id26">
<h1>0.9.1<a class="headerlink" href="#id26" title="Permalink to this headline"></a></h1>
<div class="section" id="id29">
<h1>0.9.1<a class="headerlink" href="#id29" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>PyOpenSSL is no longer required for Python 2.6: use the eventlet.green.ssl module. 2.5 and 2.4 still require PyOpenSSL.</li>
<li>Cleaned up the eventlet.green packages and their associated tests, this should result in fewer version-dependent bugs with these modules.</li>
@ -406,8 +434,8 @@
<li>Bug fixes in: wsgi.py, twistedr.py, poll.py, greenio.py, util.py, select.py, processes.py, selects.py</li>
</ul>
</div>
<div class="section" id="id27">
<h1>0.9.0<a class="headerlink" href="#id27" title="Permalink to this headline"></a></h1>
<div class="section" id="id30">
<h1>0.9.0<a class="headerlink" href="#id30" title="Permalink to this headline"></a></h1>
<ul>
<li><p class="first">Full-duplex sockets (simultaneous readers and writers in the same process).</p>
</li>
@ -427,23 +455,23 @@
</li>
</ul>
</div>
<div class="section" id="id28">
<h1>0.8.16<a class="headerlink" href="#id28" title="Permalink to this headline"></a></h1>
<div class="section" id="id31">
<h1>0.8.16<a class="headerlink" href="#id31" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>GreenSSLObject properly masks ZeroReturnErrors with an empty read; with unit test.</li>
<li>Fixed 2.6 SSL compatibility issue.</li>
</ul>
</div>
<div class="section" id="id29">
<h1>0.8.15<a class="headerlink" href="#id29" title="Permalink to this headline"></a></h1>
<div class="section" id="id32">
<h1>0.8.15<a class="headerlink" href="#id32" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>GreenSSL object no longer converts ZeroReturnErrors into empty reads, because that is more compatible with the underlying SSLConnection object.</li>
<li>Fixed issue caused by SIGCHLD handler in processes.py</li>
<li>Stopped supporting string exceptions in saranwrap and fixed a few test failures.</li>
</ul>
</div>
<div class="section" id="id30">
<h1>0.8.14<a class="headerlink" href="#id30" title="Permalink to this headline"></a></h1>
<div class="section" id="id33">
<h1>0.8.14<a class="headerlink" href="#id33" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>Fixed some more Windows compatibility problems, resolving EVT-37 :</li>
</ul>
@ -451,15 +479,15 @@
* waiting() method on Pool class, which was lost when the Pool implementation
replaced CoroutinePool.</p>
</div>
<div class="section" id="id31">
<h1>0.8.13<a class="headerlink" href="#id31" title="Permalink to this headline"></a></h1>
<div class="section" id="id34">
<h1>0.8.13<a class="headerlink" href="#id34" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>2.6 SSL compatibility patch by Marcus Cavanaugh.</li>
<li>Added greenlet and pyopenssl as dependencies in setup.py.</li>
</ul>
</div>
<div class="section" id="id32">
<h1>0.8.12<a class="headerlink" href="#id32" title="Permalink to this headline"></a></h1>
<div class="section" id="id35">
<h1>0.8.12<a class="headerlink" href="#id35" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li>The ability to resize() pools of coroutines, which was lost when the</li>
</ul>
@ -472,8 +500,8 @@ like SSL.Connection objects.
* A small patch that makes Eventlet work on Windows. This is the first
release of Eventlet that works on Windows.</p>
</div>
<div class="section" id="id33">
<h1>0.8.11<a class="headerlink" href="#id33" title="Permalink to this headline"></a></h1>
<div class="section" id="id36">
<h1>0.8.11<a class="headerlink" href="#id36" title="Permalink to this headline"></a></h1>
<p>Eventlet can now run on top of twisted reactor. Twisted-based hub is enabled automatically if
twisted.internet.reactor is imported. It is also possible to &#8220;embed&#8221; eventlet into a twisted
application via eventlet.twistedutil.join_reactor. See the examples for details.</p>
@ -527,24 +555,24 @@ Thanks to Marcus Cavanaugh for pointing out some coros.queue(0) bugs.</p>
<p>Fix the libev hub to match libev&#8217;s callback signature. (Patch by grugq)</p>
<p>Add a backlog argument to api.tcp_listener (Patch by grugq)</p>
</div>
<div class="section" id="id34">
<h1>0.7.x<a class="headerlink" href="#id34" title="Permalink to this headline"></a></h1>
<div class="section" id="id37">
<h1>0.7.x<a class="headerlink" href="#id37" title="Permalink to this headline"></a></h1>
<p>Fix a major memory leak when using the libevent or libev hubs. Timers were not being removed from the hub after they fired. (Thanks Agusto Becciu and the grugq). Also, make it possible to call wrap_socket_with_coroutine_socket without using the threadpool to make dns operations non-blocking (Thanks the grugq).</p>
<p>It&#8217;s now possible to use eventlet&#8217;s SSL client to talk to eventlet&#8217;s SSL server. (Thanks to Ryan Williams)</p>
<p>Fixed a major CPU leak when using select hub. When adding a descriptor to the hub, entries were made in all three dictionaries, readers, writers, and exc, even if the callback is None. Thus every fd would be passed into all three lists when calling select regardless of whether there was a callback for that event or not. When reading the next request out of a keepalive socket, the socket would come back as ready for writing, the hub would notice the callback is None and ignore it, and then loop as fast as possible consuming CPU.</p>
</div>
<div class="section" id="id35">
<h1>0.6.x<a class="headerlink" href="#id35" title="Permalink to this headline"></a></h1>
<div class="section" id="id38">
<h1>0.6.x<a class="headerlink" href="#id38" title="Permalink to this headline"></a></h1>
<p>Fixes some long-standing bugs where sometimes failures in accept() or connect() would cause the coroutine that was waiting to be double-resumed, most often resulting in SwitchingToDeadGreenlet exceptions as well as weird tuple-unpacking exceptions in the CoroutinePool main loop.</p>
<p>0.6.1: Added eventlet.tpool.killall. Blocks until all of the threadpool threads have been told to exit and join()ed. Meant to be used to clean up the threadpool on exit or if calling execv. Used by Spawning.</p>
</div>
<div class="section" id="id36">
<h1>0.5.x<a class="headerlink" href="#id36" title="Permalink to this headline"></a></h1>
<div class="section" id="id39">
<h1>0.5.x<a class="headerlink" href="#id39" title="Permalink to this headline"></a></h1>
<p>&#8220;The Pycon 2008 Refactor&#8221;: The first release which incorporates libevent support. Also comes with significant refactoring and code cleanup, especially to the eventlet.wsgi http server. Docstring coverage is much higher and there is new extensive documentation: <a class="reference external" href="http://wiki.secondlife.com/wiki/Eventlet/Documentation">http://wiki.secondlife.com/wiki/Eventlet/Documentation</a></p>
<p>The point releases of 0.5.x fixed some bugs in the wsgi server, most notably handling of Transfer-Encoding: chunked; previously, it would happily send chunked encoding to clients which asked for HTTP/1.0, which isn&#8217;t legal.</p>
</div>
<div class="section" id="id37">
<h1>0.2<a class="headerlink" href="#id37" title="Permalink to this headline"></a></h1>
<div class="section" id="id40">
<h1>0.2<a class="headerlink" href="#id40" title="Permalink to this headline"></a></h1>
<p>Initial re-release of forked linden branch.</p>
</div>
@ -552,56 +580,61 @@ Thanks to Marcus Cavanaugh for pointing out some coros.queue(0) bugs.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">0.16.1</a></li>
<li><a class="reference internal" href="#id2">0.16.0</a></li>
<li><a class="reference internal" href="#id3">0.15.2</a></li>
<li><a class="reference internal" href="#id4">0.15.1</a></li>
<li><a class="reference internal" href="#id5">0.15</a></li>
<li><a class="reference internal" href="#id6">0.14</a></li>
<li><a class="reference internal" href="#id7">0.13</a></li>
<li><a class="reference internal" href="#id8">0.12</a></li>
<li><a class="reference internal" href="#id9">0.11</a></li>
<li><a class="reference internal" href="#id10">0.10</a></li>
<li><a class="reference internal" href="#id11">0.9.17</a></li>
<li><a class="reference internal" href="#id12">0.9.16</a></li>
<li><a class="reference internal" href="#id13">0.9.15</a></li>
<li><a class="reference internal" href="#id14">0.9.14</a></li>
<li><a class="reference internal" href="#id15">0.9.13</a></li>
<li><a class="reference internal" href="#id16">0.9.12</a></li>
<li><a class="reference internal" href="#id17">0.9.10</a></li>
<li><a class="reference internal" href="#id18">0.9.9</a></li>
<li><a class="reference internal" href="#id19">0.9.8</a></li>
<li><a class="reference internal" href="#id20">0.9.7</a></li>
<li><a class="reference internal" href="#id21">0.9.6</a></li>
<li><a class="reference internal" href="#id22">0.9.5</a></li>
<li><a class="reference internal" href="#id23">0.9.4</a></li>
<li><a class="reference internal" href="#id24">0.9.3</a></li>
<li><a class="reference internal" href="#id25">0.9.2</a></li>
<li><a class="reference internal" href="#id26">0.9.1</a></li>
<li><a class="reference internal" href="#id27">0.9.0</a></li>
<li><a class="reference internal" href="#id28">0.8.16</a></li>
<li><a class="reference internal" href="#id29">0.8.15</a></li>
<li><a class="reference internal" href="#id30">0.8.14</a></li>
<li><a class="reference internal" href="#id31">0.8.13</a></li>
<li><a class="reference internal" href="#id32">0.8.12</a></li>
<li><a class="reference internal" href="#id33">0.8.11</a></li>
<li><a class="reference internal" href="#">0.17.2</a></li>
<li><a class="reference internal" href="#id2">0.17.1</a></li>
<li><a class="reference internal" href="#id3">0.17</a></li>
<li><a class="reference internal" href="#id4">0.16.1</a></li>
<li><a class="reference internal" href="#id5">0.16.0</a></li>
<li><a class="reference internal" href="#id6">0.15.2</a></li>
<li><a class="reference internal" href="#id7">0.15.1</a></li>
<li><a class="reference internal" href="#id8">0.15</a></li>
<li><a class="reference internal" href="#id9">0.14</a></li>
<li><a class="reference internal" href="#id10">0.13</a></li>
<li><a class="reference internal" href="#id11">0.12</a></li>
<li><a class="reference internal" href="#id12">0.11</a></li>
<li><a class="reference internal" href="#id13">0.10</a></li>
<li><a class="reference internal" href="#id14">0.9.17</a></li>
<li><a class="reference internal" href="#id15">0.9.16</a></li>
<li><a class="reference internal" href="#id16">0.9.15</a></li>
<li><a class="reference internal" href="#id17">0.9.14</a></li>
<li><a class="reference internal" href="#id18">0.9.13</a></li>
<li><a class="reference internal" href="#id19">0.9.12</a></li>
<li><a class="reference internal" href="#id20">0.9.10</a></li>
<li><a class="reference internal" href="#id21">0.9.9</a></li>
<li><a class="reference internal" href="#id22">0.9.8</a></li>
<li><a class="reference internal" href="#id23">0.9.7</a></li>
<li><a class="reference internal" href="#id24">0.9.6</a></li>
<li><a class="reference internal" href="#id25">0.9.5</a></li>
<li><a class="reference internal" href="#id26">0.9.4</a></li>
<li><a class="reference internal" href="#id27">0.9.3</a></li>
<li><a class="reference internal" href="#id28">0.9.2</a></li>
<li><a class="reference internal" href="#id29">0.9.1</a></li>
<li><a class="reference internal" href="#id30">0.9.0</a></li>
<li><a class="reference internal" href="#id31">0.8.16</a></li>
<li><a class="reference internal" href="#id32">0.8.15</a></li>
<li><a class="reference internal" href="#id33">0.8.14</a></li>
<li><a class="reference internal" href="#id34">0.8.13</a></li>
<li><a class="reference internal" href="#id35">0.8.12</a></li>
<li><a class="reference internal" href="#id36">0.8.11</a></li>
<li><a class="reference internal" href="#x">0.8.x</a></li>
<li><a class="reference internal" href="#id34">0.7.x</a></li>
<li><a class="reference internal" href="#id35">0.6.x</a></li>
<li><a class="reference internal" href="#id36">0.5.x</a></li>
<li><a class="reference internal" href="#id37">0.2</a></li>
<li><a class="reference internal" href="#id37">0.7.x</a></li>
<li><a class="reference internal" href="#id38">0.6.x</a></li>
<li><a class="reference internal" href="#id39">0.5.x</a></li>
<li><a class="reference internal" href="#id40">0.2</a></li>
</ul>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/changelog.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/changelog.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -618,7 +651,7 @@ Thanks to Marcus Cavanaugh for pointing out some coros.queue(0) bugs.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -627,13 +660,13 @@ Thanks to Marcus Cavanaugh for pointing out some coros.queue(0) bugs.</p>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Design Patterns &mdash; Eventlet 0.16.1 documentation</title>
<title>Design Patterns &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="Greening The World" href="patching.html" />
<link rel="prev" title="Basic Usage" href="basic_usage.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,14 +43,14 @@
<li class="right" >
<a href="basic_usage.html" title="Basic Usage"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="design-patterns">
<span id="id1"></span><h1>Design Patterns<a class="headerlink" href="#design-patterns" title="Permalink to this headline"></a></h1>
@ -73,10 +73,10 @@
<span class="k">print</span><span class="p">(</span><span class="s">&quot;got body&quot;</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">body</span><span class="p">))</span>
</pre></div>
</div>
<p>There is a slightly more complex version of this in the <a class="reference internal" href="examples.html#web-crawler-example"><em>web crawler example</em></a>. Here&#8217;s a tour of the interesting lines in this crawler.</p>
<p><tt class="docutils literal"><span class="pre">from</span> <span class="pre">eventlet.green</span> <span class="pre">import</span> <span class="pre">urllib2</span></tt> is how you import a cooperatively-yielding version of urllib2. It is the same in all respects to the standard version, except that it uses green sockets for its communication. This is an example of the <a class="reference internal" href="patching.html#import-green"><em>Import Green</em></a> pattern.</p>
<p><tt class="docutils literal"><span class="pre">pool</span> <span class="pre">=</span> <span class="pre">eventlet.GreenPool()</span></tt> constructs a <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool" title="eventlet.greenpool.GreenPool"><tt class="xref py py-class docutils literal"><span class="pre">GreenPool</span></tt></a> of a thousand green threads. Using a pool is good practice because it provides an upper limit on the amount of work that this crawler will be doing simultaneously, which comes in handy when the input data changes dramatically.</p>
<p><tt class="docutils literal"><span class="pre">for</span> <span class="pre">body</span> <span class="pre">in</span> <span class="pre">pool.imap(fetch,</span> <span class="pre">urls):</span></tt> iterates over the results of calling the fetch function in parallel. <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool.imap" title="eventlet.greenpool.GreenPool.imap"><tt class="xref py py-meth docutils literal"><span class="pre">imap</span></tt></a> makes the function calls in parallel, and the results are returned in the order that they were executed.</p>
<p>There is a slightly more complex version of this in the <a class="reference internal" href="examples.html#web-crawler-example"><span>web crawler example</span></a>. Here&#8217;s a tour of the interesting lines in this crawler.</p>
<p><code class="docutils literal"><span class="pre">from</span> <span class="pre">eventlet.green</span> <span class="pre">import</span> <span class="pre">urllib2</span></code> is how you import a cooperatively-yielding version of urllib2. It is the same in all respects to the standard version, except that it uses green sockets for its communication. This is an example of the <a class="reference internal" href="patching.html#import-green"><span>Import Green</span></a> pattern.</p>
<p><code class="docutils literal"><span class="pre">pool</span> <span class="pre">=</span> <span class="pre">eventlet.GreenPool()</span></code> constructs a <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool" title="eventlet.greenpool.GreenPool"><code class="xref py py-class docutils literal"><span class="pre">GreenPool</span></code></a> of a thousand green threads. Using a pool is good practice because it provides an upper limit on the amount of work that this crawler will be doing simultaneously, which comes in handy when the input data changes dramatically.</p>
<p><code class="docutils literal"><span class="pre">for</span> <span class="pre">body</span> <span class="pre">in</span> <span class="pre">pool.imap(fetch,</span> <span class="pre">urls):</span></code> iterates over the results of calling the fetch function in parallel. <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool.imap" title="eventlet.greenpool.GreenPool.imap"><code class="xref py py-meth docutils literal"><span class="pre">imap</span></code></a> makes the function calls in parallel, and the results are returned in the order that they were executed.</p>
<p>The key aspect of the client pattern is that it involves collecting the results of each function call; the fact that each fetch is done concurrently is essentially an invisible optimization. Note also that imap is memory-bounded and won&#8217;t consume gigabytes of memory if the list of urls grows to the tens of thousands (yes, we had that problem in production once!).</p>
</div>
<div class="section" id="server-pattern">
@ -97,15 +97,15 @@
<span class="n">pool</span><span class="o">.</span><span class="n">spawn_n</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="n">new_sock</span><span class="p">)</span>
</pre></div>
</div>
<p>The file <a class="reference internal" href="examples.html#echo-server-example"><em>echo server example</em></a> contains a somewhat more robust and complex version of this example.</p>
<p><tt class="docutils literal"><span class="pre">server</span> <span class="pre">=</span> <span class="pre">eventlet.listen(('0.0.0.0',</span> <span class="pre">6000))</span></tt> uses a convenience function to create a listening socket.</p>
<p><tt class="docutils literal"><span class="pre">pool</span> <span class="pre">=</span> <span class="pre">eventlet.GreenPool(10000)</span></tt> creates a pool of green threads that could handle ten thousand clients.</p>
<p><tt class="docutils literal"><span class="pre">pool.spawn_n(handle,</span> <span class="pre">new_sock)</span></tt> launches a green thread to handle the new client. The accept loop doesn&#8217;t care about the return value of the <tt class="docutils literal"><span class="pre">handle</span></tt> function, so it uses <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool.spawn_n" title="eventlet.greenpool.GreenPool.spawn_n"><tt class="xref py py-meth docutils literal"><span class="pre">spawn_n</span></tt></a>, instead of <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool.spawn" title="eventlet.greenpool.GreenPool.spawn"><tt class="xref py py-meth docutils literal"><span class="pre">spawn</span></tt></a>.</p>
<p>The difference between the server and the client patterns boils down to the fact that the server has a <tt class="docutils literal"><span class="pre">while</span></tt> loop calling <tt class="docutils literal"><span class="pre">accept()</span></tt> repeatedly, and that it hands off the client socket completely to the handle() method, rather than collecting the results.</p>
<p>The file <a class="reference internal" href="examples.html#echo-server-example"><span>echo server example</span></a> contains a somewhat more robust and complex version of this example.</p>
<p><code class="docutils literal"><span class="pre">server</span> <span class="pre">=</span> <span class="pre">eventlet.listen(('0.0.0.0',</span> <span class="pre">6000))</span></code> uses a convenience function to create a listening socket.</p>
<p><code class="docutils literal"><span class="pre">pool</span> <span class="pre">=</span> <span class="pre">eventlet.GreenPool(10000)</span></code> creates a pool of green threads that could handle ten thousand clients.</p>
<p><code class="docutils literal"><span class="pre">pool.spawn_n(handle,</span> <span class="pre">new_sock)</span></code> launches a green thread to handle the new client. The accept loop doesn&#8217;t care about the return value of the <code class="docutils literal"><span class="pre">handle</span></code> function, so it uses <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool.spawn_n" title="eventlet.greenpool.GreenPool.spawn_n"><code class="xref py py-meth docutils literal"><span class="pre">spawn_n</span></code></a>, instead of <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool.spawn" title="eventlet.greenpool.GreenPool.spawn"><code class="xref py py-meth docutils literal"><span class="pre">spawn</span></code></a>.</p>
<p>The difference between the server and the client patterns boils down to the fact that the server has a <code class="docutils literal"><span class="pre">while</span></code> loop calling <code class="docutils literal"><span class="pre">accept()</span></code> repeatedly, and that it hands off the client socket completely to the handle() method, rather than collecting the results.</p>
</div>
<div class="section" id="dispatch-pattern">
<h2>Dispatch Pattern<a class="headerlink" href="#dispatch-pattern" title="Permalink to this headline"></a></h2>
<p>One common use case that Linden Lab runs into all the time is a &#8220;dispatch&#8221; design pattern. This is a server that is also a client of some other services. Proxies, aggregators, job workers, and so on are all terms that apply here. This is the use case that the <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPile" title="eventlet.greenpool.GreenPile"><tt class="xref py py-class docutils literal"><span class="pre">GreenPile</span></tt></a> was designed for.</p>
<p>One common use case that Linden Lab runs into all the time is a &#8220;dispatch&#8221; design pattern. This is a server that is also a client of some other services. Proxies, aggregators, job workers, and so on are all terms that apply here. This is the use case that the <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPile" title="eventlet.greenpool.GreenPile"><code class="xref py py-class docutils literal"><span class="pre">GreenPile</span></code></a> was designed for.</p>
<p>Here&#8217;s a somewhat contrived example: a server that receives POSTs from clients that contain a list of urls of RSS feeds. The server fetches all the feeds concurrently and responds with a list of their titles to the client. It&#8217;s easy to imagine it doing something more complex than this, and this could be easily modified to become a Reader-style application:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">eventlet</span>
<span class="n">feedparser</span> <span class="o">=</span> <span class="n">eventlet</span><span class="o">.</span><span class="n">import_patched</span><span class="p">(</span><span class="s">&#39;feedparser&#39;</span><span class="p">)</span>
@ -125,8 +125,8 @@
<span class="k">return</span> <span class="p">[</span><span class="n">titles</span><span class="p">]</span>
</pre></div>
</div>
<p>The full version of this example is in the <a class="reference internal" href="examples.html#feed-scraper-example"><em>Feed Scraper</em></a>, which includes code to start the WSGI server on a particular port.</p>
<p>This example uses a global (gasp) <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool" title="eventlet.greenpool.GreenPool"><tt class="xref py py-class docutils literal"><span class="pre">GreenPool</span></tt></a> to control concurrency. If we didn&#8217;t have a global limit on the number of outgoing requests, then a client could cause the server to open tens of thousands of concurrent connections to external servers, thereby getting feedscraper&#8217;s IP banned, or various other accidental-or-on-purpose bad behavior. The pool isn&#8217;t a complete DoS protection, but it&#8217;s the bare minimum.</p>
<p>The full version of this example is in the <a class="reference internal" href="examples.html#feed-scraper-example"><span>Feed Scraper</span></a>, which includes code to start the WSGI server on a particular port.</p>
<p>This example uses a global (gasp) <a class="reference internal" href="modules/greenpool.html#eventlet.greenpool.GreenPool" title="eventlet.greenpool.GreenPool"><code class="xref py py-class docutils literal"><span class="pre">GreenPool</span></code></a> to control concurrency. If we didn&#8217;t have a global limit on the number of outgoing requests, then a client could cause the server to open tens of thousands of concurrent connections to external servers, thereby getting feedscraper&#8217;s IP banned, or various other accidental-or-on-purpose bad behavior. The pool isn&#8217;t a complete DoS protection, but it&#8217;s the bare minimum.</p>
<p>The interesting lines are in the app function:</p>
<div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
@ -139,7 +139,7 @@
</td></tr></table></div>
<p>Note that in line 1, the Pile is constructed using the global pool as its argument. That ties the Pile&#8217;s concurrency to the global&#8217;s. If there are already 1000 concurrent fetches from other clients of feedscraper, this one will block until some of those complete. Limitations are good!</p>
<p>Line 3 is just a spawn, but note that we don&#8217;t store any return value from it. This is because the return value is kept in the Pile itself. This becomes evident in the next line...</p>
<p>Line 4 is where we use the fact that the Pile is an iterator. Each element in the iterator is one of the return values from the fetch_title function, which are strings. We can use a normal Python idiom (<tt class="xref py py-func docutils literal"><span class="pre">join()</span></tt>) to concatenate these incrementally as they happen.</p>
<p>Line 4 is where we use the fact that the Pile is an iterator. Each element in the iterator is one of the return values from the fetch_title function, which are strings. We can use a normal Python idiom (<code class="xref py py-func docutils literal"><span class="pre">join()</span></code>) to concatenate these incrementally as they happen.</p>
</div>
</div>
@ -147,7 +147,7 @@
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
@ -165,12 +165,14 @@
<h4>Next topic</h4>
<p class="topless"><a href="patching.html"
title="next chapter">Greening The World</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/design_patterns.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/design_patterns.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -187,7 +189,7 @@
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -202,13 +204,13 @@
<li class="right" >
<a href="basic_usage.html" title="Basic Usage"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Environment Variables &mdash; Eventlet 0.16.1 documentation</title>
<title>Environment Variables &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="Module Reference" href="modules.html" />
<link rel="prev" title="Testing Eventlet" href="testing.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,14 +43,14 @@
<li class="right" >
<a href="testing.html" title="Testing Eventlet"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="environment-variables">
<span id="env-vars"></span><h1>Environment Variables<a class="headerlink" href="#environment-variables" title="Permalink to this headline"></a></h1>
@ -59,13 +59,13 @@ These are only for the advanced user.</p>
<p>EVENTLET_HUB</p>
<blockquote>
<div>Used to force Eventlet to use the specified hub instead of the
optimal one. See <a class="reference internal" href="hubs.html#understanding-hubs"><em>Understanding Eventlet Hubs</em></a> for the list of
optimal one. See <a class="reference internal" href="hubs.html#understanding-hubs"><span>Understanding Eventlet Hubs</span></a> for the list of
acceptable hubs and what they mean (note that picking a hub not on
the list will silently fail). Equivalent to calling
<a class="reference internal" href="hubs.html#eventlet.hubs.use_hub" title="eventlet.hubs.use_hub"><tt class="xref py py-meth docutils literal"><span class="pre">eventlet.hubs.use_hub()</span></tt></a> at the beginning of the program.</div></blockquote>
<a class="reference internal" href="hubs.html#eventlet.hubs.use_hub" title="eventlet.hubs.use_hub"><code class="xref py py-meth docutils literal"><span class="pre">eventlet.hubs.use_hub()</span></code></a> at the beginning of the program.</div></blockquote>
<p>EVENTLET_THREADPOOL_SIZE</p>
<blockquote>
<div>The size of the threadpool in <a class="reference internal" href="threading.html#module-eventlet.tpool" title="eventlet.tpool"><tt class="xref py py-mod docutils literal"><span class="pre">tpool</span></tt></a>. This is an
<div>The size of the threadpool in <a class="reference internal" href="threading.html#module-eventlet.tpool" title="eventlet.tpool"><code class="xref py py-mod docutils literal"><span class="pre">tpool</span></code></a>. This is an
environment variable because tpool constructs its pool on first
use, so any control of the pool size needs to happen before then.</div></blockquote>
</div>
@ -74,7 +74,7 @@ use, so any control of the pool size needs to happen before then.</div></blockqu
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="testing.html"
@ -82,12 +82,14 @@ use, so any control of the pool size needs to happen before then.</div></blockqu
<h4>Next topic</h4>
<p class="topless"><a href="modules.html"
title="next chapter">Module Reference</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/environment.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/environment.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -104,7 +106,7 @@ use, so any control of the pool size needs to happen before then.</div></blockqu
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -119,13 +121,13 @@ use, so any control of the pool size needs to happen before then.</div></blockqu
<li class="right" >
<a href="testing.html" title="Testing Eventlet"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Examples &mdash; Eventlet 0.16.1 documentation</title>
<title>Examples &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="Using SSL With Eventlet" href="ssl.html" />
<link rel="prev" title="Greening The World" href="patching.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,21 +43,21 @@
<li class="right" >
<a href="patching.html" title="Greening The World"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="examples">
<h1>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h1>
<p>Here are a bunch of small example programs that use Eventlet. All of these examples can be found in the <tt class="docutils literal"><span class="pre">examples</span></tt> directory of a source copy of Eventlet.</p>
<p>Here are a bunch of small example programs that use Eventlet. All of these examples can be found in the <code class="docutils literal"><span class="pre">examples</span></code> directory of a source copy of Eventlet.</p>
<div class="section" id="web-crawler">
<span id="web-crawler-example"></span><h2>Web Crawler<a class="headerlink" href="#web-crawler" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/webcrawler.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/webcrawler.py</span></code></p>
<div class="highlight-python"><div class="highlight"><pre><span class="c">#!/usr/bin/env python</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">This is a simple web &quot;crawler&quot; that fetches a bunch of urls using a pool to</span>
@ -93,7 +93,7 @@
</div>
<div class="section" id="wsgi-server">
<span id="wsgi-server-example"></span><h2>WSGI Server<a class="headerlink" href="#wsgi-server" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/wsgi.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/wsgi.py</span></code></p>
<div class="highlight-python"><div class="highlight"><pre><span class="sd">&quot;&quot;&quot;This is a simple example of running a wsgi application with eventlet.</span>
<span class="sd">For a more fully-featured server which supports multiple processes,</span>
<span class="sd">multiple threads, and graceful code reloading, see:</span>
@ -118,7 +118,7 @@
</div>
<div class="section" id="echo-server">
<span id="echo-server-example"></span><h2>Echo Server<a class="headerlink" href="#echo-server" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/echoserver.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/echoserver.py</span></code></p>
<div class="highlight-python"><div class="highlight"><pre><span class="c">#! /usr/bin/env python</span>
<span class="sd">&quot;&quot;&quot;\</span>
<span class="sd">Simple server that listens on port 6000 and echos back every input to</span>
@ -162,7 +162,7 @@
</div>
<div class="section" id="socket-connect">
<span id="socket-connect-example"></span><h2>Socket Connect<a class="headerlink" href="#socket-connect" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/connect.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/connect.py</span></code></p>
<div class="highlight-python"><div class="highlight"><pre><span class="sd">&quot;&quot;&quot;Spawn multiple workers and collect their results.</span>
<span class="sd">Demonstrates how to use the eventlet.green.socket module.</span>
@ -196,7 +196,7 @@
</div>
<div class="section" id="multi-user-chat-server">
<span id="chat-server-example"></span><h2>Multi-User Chat Server<a class="headerlink" href="#multi-user-chat-server" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/chat_server.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/chat_server.py</span></code></p>
<p>This is a little different from the echo server, in that it broadcasts the
messages to all participants, not just the sender.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">eventlet</span>
@ -242,7 +242,7 @@ messages to all participants, not just the sender.</p>
</div>
<div class="section" id="feed-scraper">
<span id="feed-scraper-example"></span><h2>Feed Scraper<a class="headerlink" href="#feed-scraper" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/feedscraper.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/feedscraper.py</span></code></p>
<p>This example requires <a class="reference external" href="http://www.feedparser.org/">Feedparser</a> to be installed or on the PYTHONPATH.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="sd">&quot;&quot;&quot;A simple web server that accepts POSTS containing a list of feed urls,</span>
<span class="sd">and returns the titles of those feeds.</span>
@ -286,7 +286,7 @@ messages to all participants, not just the sender.</p>
</div>
<div class="section" id="port-forwarder">
<span id="forwarder-example"></span><h2>Port Forwarder<a class="headerlink" href="#port-forwarder" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/forwarder.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/forwarder.py</span></code></p>
<div class="highlight-python"><div class="highlight"><pre><span class="sd">&quot;&quot;&quot; This is an incredibly simple port forwarder from port 7000 to 22 on</span>
<span class="sd">localhost. It calls a callback function when the socket is closed, to</span>
<span class="sd">demonstrate one way that you could start to do interesting things by</span>
@ -321,7 +321,7 @@ messages to all participants, not just the sender.</p>
</div>
<div class="section" id="recursive-web-crawler">
<span id="recursive-crawler-example"></span><h2>Recursive Web Crawler<a class="headerlink" href="#recursive-web-crawler" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/recursive_crawler.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/recursive_crawler.py</span></code></p>
<p>This is an example recursive web crawler that fetches linked pages from a seed url.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="sd">&quot;&quot;&quot;This is a recursive web crawler. Don&#39;t go pointing this at random sites;</span>
<span class="sd">it doesn&#39;t respect robots.txt and it is pretty brutal about how quickly it</span>
@ -378,7 +378,7 @@ messages to all participants, not just the sender.</p>
</div>
<div class="section" id="producer-consumer-web-crawler">
<span id="producer-consumer-example"></span><h2>Producer Consumer Web Crawler<a class="headerlink" href="#producer-consumer-web-crawler" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/producer_consumer.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/producer_consumer.py</span></code></p>
<p>This is an example implementation of the producer/consumer pattern as well as being identical in functionality to the recursive web crawler.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="sd">&quot;&quot;&quot;This is a recursive web crawler. Don&#39;t go pointing this at random sites;</span>
<span class="sd">it doesn&#39;t respect robots.txt and it is pretty brutal about how quickly it</span>
@ -442,7 +442,7 @@ messages to all participants, not just the sender.</p>
</div>
<div class="section" id="websocket-server-example">
<span id="websocket-example"></span><h2>Websocket Server Example<a class="headerlink" href="#websocket-server-example" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/websocket.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/websocket.py</span></code></p>
<p>This exercises some of the features of the websocket server
implementation.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">eventlet</span>
@ -493,7 +493,7 @@ implementation.</p>
</div>
<div class="section" id="websocket-multi-user-chat-example">
<span id="websocket-chat-example"></span><h2>Websocket Multi-User Chat Example<a class="headerlink" href="#websocket-multi-user-chat-example" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">examples/websocket_chat.py</span></tt></p>
<p><code class="docutils literal"><span class="pre">examples/websocket_chat.py</span></code></p>
<p>This is a mashup of the websocket example and the multi-user chat example, showing how you can do the same sorts of things with websockets that you can do with regular sockets.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">os</span>
@ -543,7 +543,7 @@ implementation.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
@ -569,12 +569,14 @@ implementation.</p>
<h4>Next topic</h4>
<p class="topless"><a href="ssl.html"
title="next chapter">Using SSL With Eventlet</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/examples.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/examples.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -591,7 +593,7 @@ implementation.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -606,13 +608,13 @@ implementation.</p>
<li class="right" >
<a href="patching.html" title="Greening The World"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -7,15 +7,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Index &mdash; Eventlet 0.16.1 documentation</title>
<title>Index &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,10 +24,10 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -36,14 +36,14 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<h1 id="index">Index</h1>
@ -61,7 +61,6 @@
| <a href="#J"><strong>J</strong></a>
| <a href="#K"><strong>K</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#N"><strong>N</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#Q"><strong>Q</strong></a>
@ -124,18 +123,10 @@
<dt><a href="modules/db_pool.html#eventlet.db_pool.BaseConnectionPool">BaseConnectionPool (class in eventlet.db_pool)</a>
</dt>
<dt><a href="modules/db_pool.html#eventlet.db_pool.GenericConnectionWrapper.begin">begin() (eventlet.db_pool.GenericConnectionWrapper method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.bind">bind() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.bind_to_random_port">bind_to_random_port() (eventlet.green.zmq.Socket method)</a>
<dt><a href="modules/db_pool.html#eventlet.db_pool.GenericConnectionWrapper.begin">begin() (eventlet.db_pool.GenericConnectionWrapper method)</a>
</dt>
@ -198,20 +189,16 @@
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.close">(eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/websocket.html#eventlet.websocket.WebSocket.close">(eventlet.websocket.WebSocket method)</a>
</dt>
</dl></dd>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/db_pool.html#eventlet.db_pool.GenericConnectionWrapper.commit">commit() (eventlet.db_pool.GenericConnectionWrapper method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/db_pool.html#eventlet.db_pool.RawConnectionPool.connect">connect() (eventlet.db_pool.RawConnectionPool class method)</a>
</dt>
@ -222,10 +209,6 @@
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.connect">(eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="basic_usage.html#eventlet.connect">(in module eventlet)</a>
</dt>
@ -239,10 +222,6 @@
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Context">Context() (in module eventlet.green.zmq)</a>
</dt>
<dt><a href="modules/db_pool.html#eventlet.db_pool.RawConnectionPool.create">create() (eventlet.db_pool.RawConnectionPool method)</a>
</dt>
@ -274,17 +253,9 @@
<dt><a href="modules/db_pool.html#eventlet.db_pool.DatabaseConnector">DatabaseConnector (class in eventlet.db_pool)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.disable_monitor">disable_monitor() (eventlet.green.zmq.Socket method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.disconnect">disconnect() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/db_pool.html#eventlet.db_pool.GenericConnectionWrapper.dump_debug_info">dump_debug_info() (eventlet.db_pool.GenericConnectionWrapper method)</a>
</dt>
@ -339,10 +310,6 @@
</dt>
<dt><a href="modules/zmq.html#module-eventlet.green.zmq">eventlet.green.zmq (module)</a>
</dt>
<dt><a href="basic_usage.html#eventlet.GreenPile">eventlet.GreenPile (built-in class)</a>
</dt>
@ -366,12 +333,12 @@
<dt><a href="basic_usage.html#eventlet.import_patched">eventlet.import_patched() (built-in function)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="basic_usage.html#eventlet.monkey_patch">eventlet.monkey_patch() (built-in function)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="patching.html#eventlet.patcher.import_patched">eventlet.patcher.import_patched() (built-in function)</a>
</dt>
@ -498,10 +465,6 @@
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.get">(eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/pools.html#eventlet.pools.Pool.get">(eventlet.pools.Pool method)</a>
</dt>
@ -519,37 +482,13 @@
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.get_hwm">get_hwm() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/corolocal.html#eventlet.corolocal.get_ident">get_ident() (in module eventlet.corolocal)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.get_monitor_socket">get_monitor_socket() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/queue.html#eventlet.queue.LightQueue.get_nowait">get_nowait() (eventlet.queue.LightQueue method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.get_string">get_string() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.getsockopt">getsockopt() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.getsockopt_string">getsockopt_string() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.getsockopt_unicode">getsockopt_unicode() (eventlet.green.zmq.Socket method)</a>
<dt><a href="modules/queue.html#eventlet.queue.LightQueue.get_nowait">get_nowait() (eventlet.queue.LightQueue method)</a>
</dt>
@ -596,10 +535,6 @@
<dt><a href="modules/debug.html#eventlet.debug.hub_timer_stacks">hub_timer_stacks() (in module eventlet.debug)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.hwm">hwm (eventlet.green.zmq.Socket attribute)</a>
</dt>
</dl></td>
</tr></table>
@ -697,16 +632,6 @@
</dl></td>
</tr></table>
<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.monitor">monitor() (eventlet.green.zmq.Socket method)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="N">N</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
@ -729,10 +654,6 @@
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.poll">poll() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/pools.html#eventlet.pools.Pool">Pool (class in eventlet.pools)</a>
</dt>
@ -740,12 +661,12 @@
<dt><a href="modules/db_pool.html#eventlet.db_pool.PooledConnectionWrapper">PooledConnectionWrapper (class in eventlet.db_pool)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/queue.html#eventlet.queue.PriorityQueue">PriorityQueue (class in eventlet.queue)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="threading.html#eventlet.tpool.Proxy">Proxy (class in eventlet.tpool)</a>
</dt>
@ -807,32 +728,6 @@
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.recv">recv() (eventlet.green.zmq.Socket method)</a>, <a href="modules/zmq.html#eventlet.green.zmq.Socket.recv">[1]</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.recv_json">recv_json() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.recv_multipart">recv_multipart() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.recv_pyobj">recv_pyobj() (eventlet.green.zmq.Socket method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.recv_string">recv_string() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.recv_unicode">recv_unicode() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/semaphore.html#eventlet.semaphore.BoundedSemaphore.release">release() (eventlet.semaphore.BoundedSemaphore method)</a>
</dt>
@ -846,6 +741,8 @@
</dt>
</dl></dd>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/greenpool.html#eventlet.greenpool.GreenPool.resize">resize() (eventlet.greenpool.GreenPool method)</a>
</dt>
@ -888,10 +785,6 @@
<dd><dl>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.send">(eventlet.green.zmq.Socket method)</a>, <a href="modules/zmq.html#eventlet.green.zmq.Socket.send">[1]</a>
</dt>
<dt><a href="modules/websocket.html#eventlet.websocket.WebSocket.send">(eventlet.websocket.WebSocket method)</a>
</dt>
@ -901,26 +794,6 @@
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.send_json">send_json() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.send_multipart">send_multipart() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.send_pyobj">send_pyobj() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.send_string">send_string() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.send_unicode">send_unicode() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="basic_usage.html#eventlet.serve">serve() (in module eventlet)</a>
</dt>
@ -933,18 +806,10 @@
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.set">set() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/db_pool.html#eventlet.db_pool.GenericConnectionWrapper.set_character_set">set_character_set() (eventlet.db_pool.GenericConnectionWrapper method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.set_hwm">set_hwm() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/db_pool.html#eventlet.db_pool.GenericConnectionWrapper.set_server_option">set_server_option() (eventlet.db_pool.GenericConnectionWrapper method)</a>
</dt>
@ -953,28 +818,6 @@
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.set_string">set_string() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.setsockopt">setsockopt() (eventlet.green.zmq.Socket method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.setsockopt_string">setsockopt_string() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.setsockopt_unicode">setsockopt_unicode() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.shadow">shadow() (eventlet.green.zmq.Socket class method)</a>
</dt>
<dt><a href="modules/db_pool.html#eventlet.db_pool.GenericConnectionWrapper.show_warnings">show_warnings() (eventlet.db_pool.GenericConnectionWrapper method)</a>
</dt>
@ -982,15 +825,13 @@
<dt><a href="modules/db_pool.html#eventlet.db_pool.GenericConnectionWrapper.shutdown">shutdown() (eventlet.db_pool.GenericConnectionWrapper method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/greenthread.html#eventlet.greenthread.sleep">sleep() (in module eventlet.greenthread)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket">Socket (class in eventlet.green.zmq)</a>
</dt>
<dt><a href="modules/greenpool.html#eventlet.greenpool.GreenPile.spawn">spawn() (eventlet.greenpool.GreenPile method)</a>
</dt>
@ -1089,23 +930,15 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.unbind">unbind() (eventlet.green.zmq.Socket method)</a>
</dt>
<dt><a href="modules/zmq.html#eventlet.green.zmq.Socket.underlying">underlying (eventlet.green.zmq.Socket attribute)</a>
</dt>
<dt><a href="modules/greenthread.html#eventlet.greenthread.GreenThread.unlink">unlink() (eventlet.greenthread.GreenThread method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/debug.html#eventlet.debug.unspew">unspew() (in module eventlet.debug)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules/db_pool.html#eventlet.db_pool.GenericConnectionWrapper.use_result">use_result() (eventlet.db_pool.GenericConnectionWrapper method)</a>
</dt>
@ -1180,12 +1013,12 @@
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -1202,7 +1035,7 @@
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -1211,13 +1044,13 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>History &mdash; Eventlet 0.16.1 documentation</title>
<title>History &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,11 +23,11 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="prev" title="Authors" href="authors.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -39,14 +39,14 @@
<li class="right" >
<a href="authors.html" title="Authors"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="history">
<h1>History<a class="headerlink" href="#history" title="Permalink to this headline"></a></h1>
@ -54,7 +54,7 @@
<ul class="simple">
<li><a class="reference external" href="http://svn.red-bean.com/bob/eventlet/trunk/">http://svn.red-bean.com/bob/eventlet/trunk/</a></li>
</ul>
<p>When Donovan started at Linden Lab in May of 2006, he added eventlet as an svn external in the <tt class="docutils literal"><span class="pre">indra/lib/python</span> <span class="pre">directory</span></tt>, to be a dependency of the yet-to-be-named backbone project (at the time, it was named restserv). However, including eventlet as an svn external meant that any time the externally hosted project had hosting issues, Linden developers were not able to perform svn updates. Thus, the eventlet source was imported into the linden source tree at the same location, and became a fork.</p>
<p>When Donovan started at Linden Lab in May of 2006, he added eventlet as an svn external in the <code class="docutils literal"><span class="pre">indra/lib/python</span> <span class="pre">directory</span></code>, to be a dependency of the yet-to-be-named backbone project (at the time, it was named restserv). However, including eventlet as an svn external meant that any time the externally hosted project had hosting issues, Linden developers were not able to perform svn updates. Thus, the eventlet source was imported into the linden source tree at the same location, and became a fork.</p>
<p>Bob Ippolito has ceased working on eventlet and has stated his desire for Linden to take it&#8217;s fork forward to the open source world as &#8220;the&#8221; eventlet.</p>
</div>
@ -62,17 +62,19 @@
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="authors.html"
title="previous chapter">Authors</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/history.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/history.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -89,7 +91,7 @@
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -101,13 +103,13 @@
<li class="right" >
<a href="authors.html" title="Authors"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Understanding Eventlet Hubs &mdash; Eventlet 0.16.1 documentation</title>
<title>Understanding Eventlet Hubs &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="Testing Eventlet" href="testing.html" />
<link rel="prev" title="Zeromq" href="zeromq.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,14 +43,14 @@
<li class="right" >
<a href="zeromq.html" title="Zeromq"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="understanding-eventlet-hubs">
<span id="understanding-hubs"></span><h1>Understanding Eventlet Hubs<a class="headerlink" href="#understanding-eventlet-hubs" title="Permalink to this headline"></a></h1>
@ -66,37 +66,37 @@
<dt><strong>pyevent</strong></dt>
<dd>This is a libevent-based backend and is thus the fastest. It&#8217;s disabled by default, because it does not support native threads, but you can enable it yourself if your use case doesn&#8217;t require them. (You have to install pyevent, too.)</dd>
</dl>
<p>If the selected hub is not ideal for the application, another can be selected. You can make the selection either with the environment variable <a class="reference internal" href="environment.html#env-vars"><em>EVENTLET_HUB</em></a>, or with use_hub.</p>
<p>If the selected hub is not ideal for the application, another can be selected. You can make the selection either with the environment variable <a class="reference internal" href="environment.html#env-vars"><span>EVENTLET_HUB</span></a>, or with use_hub.</p>
<dl class="function">
<dt id="eventlet.hubs.use_hub">
<tt class="descclassname">eventlet.hubs.</tt><tt class="descname">use_hub</tt><big>(</big><em>hub=None</em><big>)</big><a class="headerlink" href="#eventlet.hubs.use_hub" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.hubs.</code><code class="descname">use_hub</code><span class="sig-paren">(</span><em>hub=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.hubs.use_hub" title="Permalink to this definition"></a></dt>
<dd><p>Use this to control which hub Eventlet selects. Call it with the name of the desired hub module. Make sure to do this before the application starts doing any I/O! Calling use_hub completely eliminates the old hub, and any file descriptors or timers that it had been managing will be forgotten. Put the call as one of the first lines in the main module.:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="sd">&quot;&quot;&quot; This is the main module &quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">hubs</span>
<span class="n">hubs</span><span class="o">.</span><span class="n">use_hub</span><span class="p">(</span><span class="s">&quot;pyevent&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>Hubs are implemented as thread-local class instances. <a class="reference internal" href="#eventlet.hubs.use_hub" title="eventlet.hubs.use_hub"><tt class="xref py py-func docutils literal"><span class="pre">eventlet.hubs.use_hub()</span></tt></a> only operates on the current thread. When using multiple threads that each need their own hub, call <a class="reference internal" href="#eventlet.hubs.use_hub" title="eventlet.hubs.use_hub"><tt class="xref py py-func docutils literal"><span class="pre">eventlet.hubs.use_hub()</span></tt></a> at the beginning of each thread function that needs a specific hub. In practice, it may not be necessary to specify a hub in each thread; it works to use one special hub for the main thread, and let other threads use the default hub; this hybrid hub configuration will work fine.</p>
<p>It is also possible to use a third-party hub module in place of one of the built-in ones. Simply pass the module itself to <a class="reference internal" href="#eventlet.hubs.use_hub" title="eventlet.hubs.use_hub"><tt class="xref py py-func docutils literal"><span class="pre">eventlet.hubs.use_hub()</span></tt></a>. The task of writing such a hub is a little beyond the scope of this document, it&#8217;s probably a good idea to simply inspect the code of the existing hubs to see how they work.:</p>
<p>Hubs are implemented as thread-local class instances. <a class="reference internal" href="#eventlet.hubs.use_hub" title="eventlet.hubs.use_hub"><code class="xref py py-func docutils literal"><span class="pre">eventlet.hubs.use_hub()</span></code></a> only operates on the current thread. When using multiple threads that each need their own hub, call <a class="reference internal" href="#eventlet.hubs.use_hub" title="eventlet.hubs.use_hub"><code class="xref py py-func docutils literal"><span class="pre">eventlet.hubs.use_hub()</span></code></a> at the beginning of each thread function that needs a specific hub. In practice, it may not be necessary to specify a hub in each thread; it works to use one special hub for the main thread, and let other threads use the default hub; this hybrid hub configuration will work fine.</p>
<p>It is also possible to use a third-party hub module in place of one of the built-in ones. Simply pass the module itself to <a class="reference internal" href="#eventlet.hubs.use_hub" title="eventlet.hubs.use_hub"><code class="xref py py-func docutils literal"><span class="pre">eventlet.hubs.use_hub()</span></code></a>. The task of writing such a hub is a little beyond the scope of this document, it&#8217;s probably a good idea to simply inspect the code of the existing hubs to see how they work.:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">hubs</span>
<span class="kn">from</span> <span class="nn">mypackage</span> <span class="kn">import</span> <span class="n">myhub</span>
<span class="n">hubs</span><span class="o">.</span><span class="n">use_hub</span><span class="p">(</span><span class="n">myhub</span><span class="p">)</span>
</pre></div>
</div>
<p>Supplying None as the argument to <a class="reference internal" href="#eventlet.hubs.use_hub" title="eventlet.hubs.use_hub"><tt class="xref py py-func docutils literal"><span class="pre">eventlet.hubs.use_hub()</span></tt></a> causes it to select the default hub.</p>
<p>Supplying None as the argument to <a class="reference internal" href="#eventlet.hubs.use_hub" title="eventlet.hubs.use_hub"><code class="xref py py-func docutils literal"><span class="pre">eventlet.hubs.use_hub()</span></code></a> causes it to select the default hub.</p>
</dd></dl>
<div class="section" id="how-the-hubs-work">
<h2>How the Hubs Work<a class="headerlink" href="#how-the-hubs-work" title="Permalink to this headline"></a></h2>
<p>The hub has a main greenlet, MAINLOOP. When one of the running coroutines needs
to do some I/O, it registers a listener with the hub (so that the hub knows when to wake it up again), and then switches to MAINLOOP (via <tt class="docutils literal"><span class="pre">get_hub().switch()</span></tt>). If there are other coroutines that are ready to run, MAINLOOP switches to them, and when they complete or need to do more I/O, they switch back to the MAINLOOP. In this manner, MAINLOOP ensures that every coroutine gets scheduled when it has some work to do.</p>
to do some I/O, it registers a listener with the hub (so that the hub knows when to wake it up again), and then switches to MAINLOOP (via <code class="docutils literal"><span class="pre">get_hub().switch()</span></code>). If there are other coroutines that are ready to run, MAINLOOP switches to them, and when they complete or need to do more I/O, they switch back to the MAINLOOP. In this manner, MAINLOOP ensures that every coroutine gets scheduled when it has some work to do.</p>
<p>MAINLOOP is launched only when the first I/O operation happens, and it is not the same greenlet that __main__ is running in. This lazy launching is why it&#8217;s not necessary to explicitly call a dispatch() method like other frameworks, which in turn means that code can start using Eventlet without needing to be substantially restructured.</p>
</div>
<div class="section" id="more-hub-related-functions">
<h2>More Hub-Related Functions<a class="headerlink" href="#more-hub-related-functions" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="eventlet.hubs.get_hub">
<tt class="descclassname">eventlet.hubs.</tt><tt class="descname">get_hub</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.hubs.get_hub" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.hubs.</code><code class="descname">get_hub</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.hubs.get_hub" title="Permalink to this definition"></a></dt>
<dd><p>Get the current event hub singleton object.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
@ -107,7 +107,7 @@ unexpectedly without being deprecated first.</p>
<dl class="function">
<dt id="eventlet.hubs.get_default_hub">
<tt class="descclassname">eventlet.hubs.</tt><tt class="descname">get_default_hub</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.hubs.get_default_hub" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.hubs.</code><code class="descname">get_default_hub</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.hubs.get_default_hub" title="Permalink to this definition"></a></dt>
<dd><p>Select the default hub implementation based on what multiplexing
libraries are installed. The order that the hubs are tried is:</p>
<ul class="simple">
@ -127,15 +127,15 @@ unexpectedly without being deprecated first.</p>
<dl class="function">
<dt id="eventlet.hubs.trampoline">
<tt class="descclassname">eventlet.hubs.</tt><tt class="descname">trampoline</tt><big>(</big><em>fd</em>, <em>read=None</em>, <em>write=None</em>, <em>timeout=None</em>, <em>timeout_exc=&lt;class 'eventlet.timeout.Timeout'&gt;</em>, <em>mark_as_closed=None</em><big>)</big><a class="headerlink" href="#eventlet.hubs.trampoline" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.hubs.</code><code class="descname">trampoline</code><span class="sig-paren">(</span><em>fd</em>, <em>read=None</em>, <em>write=None</em>, <em>timeout=None</em>, <em>timeout_exc=&lt;class 'eventlet.timeout.Timeout'&gt;</em>, <em>mark_as_closed=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.hubs.trampoline" title="Permalink to this definition"></a></dt>
<dd><p>Suspend the current coroutine until the given socket object or file
descriptor is ready to <em>read</em>, ready to <em>write</em>, or the specified
<em>timeout</em> elapses, depending on arguments specified.</p>
<p>To wait for <em>fd</em> to be ready to read, pass <em>read</em> <tt class="docutils literal"><span class="pre">=True</span></tt>; ready to
write, pass <em>write</em> <tt class="docutils literal"><span class="pre">=True</span></tt>. To specify a timeout, pass the <em>timeout</em>
<p>To wait for <em>fd</em> to be ready to read, pass <em>read</em> <code class="docutils literal"><span class="pre">=True</span></code>; ready to
write, pass <em>write</em> <code class="docutils literal"><span class="pre">=True</span></code>. To specify a timeout, pass the <em>timeout</em>
argument in seconds.</p>
<p>If the specified <em>timeout</em> elapses before the socket is ready to read or
write, <em>timeout_exc</em> will be raised instead of <tt class="docutils literal"><span class="pre">trampoline()</span></tt>
write, <em>timeout_exc</em> will be raised instead of <code class="docutils literal"><span class="pre">trampoline()</span></code>
returning normally.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
@ -151,7 +151,7 @@ unexpectedly without being deprecated first.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
@ -168,12 +168,14 @@ unexpectedly without being deprecated first.</p>
<h4>Next topic</h4>
<p class="topless"><a href="testing.html"
title="next chapter">Testing Eventlet</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/hubs.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/hubs.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -190,7 +192,7 @@ unexpectedly without being deprecated first.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -205,13 +207,13 @@ unexpectedly without being deprecated first.</p>
<li class="right" >
<a href="zeromq.html" title="Zeromq"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Eventlet Documentation &mdash; Eventlet 0.16.1 documentation</title>
<title>Eventlet Documentation &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,11 +23,11 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="#" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="#" />
<link rel="next" title="Basic Usage" href="basic_usage.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -39,14 +39,14 @@
<li class="right" >
<a href="basic_usage.html" title="Basic Usage"
accesskey="N">next</a> |</li>
<li><a href="#">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="#">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="eventlet-documentation">
<h1>Eventlet Documentation<a class="headerlink" href="#eventlet-documentation" title="Permalink to this headline"></a></h1>
@ -136,21 +136,21 @@
</li>
<li class="toctree-l1"><a class="reference internal" href="environment.html">Environment Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Module Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="modules/backdoor.html"><tt class="docutils literal"><span class="pre">backdoor</span></tt> &#8211; Python interactive interpreter within a running process</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/corolocal.html"><tt class="docutils literal"><span class="pre">corolocal</span></tt> &#8211; Coroutine local storage</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/debug.html"><tt class="docutils literal"><span class="pre">debug</span></tt> &#8211; Debugging tools for Eventlet</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/db_pool.html"><tt class="docutils literal"><span class="pre">db_pool</span></tt> &#8211; DBAPI 2 database connection pooling</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/event.html"><tt class="docutils literal"><span class="pre">event</span></tt> &#8211; Cross-greenthread primitive</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/greenpool.html"><tt class="docutils literal"><span class="pre">greenpool</span></tt> &#8211; Green Thread Pools</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/greenthread.html"><tt class="docutils literal"><span class="pre">greenthread</span></tt> &#8211; Green Thread Implementation</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/pools.html"><tt class="docutils literal"><span class="pre">pools</span></tt> - Generic pools of resources</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/queue.html"><tt class="docutils literal"><span class="pre">queue</span></tt> &#8211; Queue class</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/semaphore.html"><tt class="docutils literal"><span class="pre">semaphore</span></tt> &#8211; Semaphore classes</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/timeout.html"><tt class="docutils literal"><span class="pre">timeout</span></tt> &#8211; Universal Timeouts</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/websocket.html"><tt class="docutils literal"><span class="pre">websocket</span></tt> &#8211; Websocket Server</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/wsgi.html"><tt class="docutils literal"><span class="pre">wsgi</span></tt> &#8211; WSGI server</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/zmq.html"><tt class="docutils literal"><span class="pre">eventlet.green.zmq</span></tt> &#8211; ØMQ support</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/zmq.html#zmq-the-pyzmq-omq-python-bindings"><tt class="docutils literal"><span class="pre">zmq</span></tt> &#8211; The pyzmq ØMQ python bindings</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/backdoor.html"><code class="docutils literal"><span class="pre">backdoor</span></code> &#8211; Python interactive interpreter within a running process</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/corolocal.html"><code class="docutils literal"><span class="pre">corolocal</span></code> &#8211; Coroutine local storage</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/debug.html"><code class="docutils literal"><span class="pre">debug</span></code> &#8211; Debugging tools for Eventlet</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/db_pool.html"><code class="docutils literal"><span class="pre">db_pool</span></code> &#8211; DBAPI 2 database connection pooling</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/event.html"><code class="docutils literal"><span class="pre">event</span></code> &#8211; Cross-greenthread primitive</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/greenpool.html"><code class="docutils literal"><span class="pre">greenpool</span></code> &#8211; Green Thread Pools</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/greenthread.html"><code class="docutils literal"><span class="pre">greenthread</span></code> &#8211; Green Thread Implementation</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/pools.html"><code class="docutils literal"><span class="pre">pools</span></code> - Generic pools of resources</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/queue.html"><code class="docutils literal"><span class="pre">queue</span></code> &#8211; Queue class</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/semaphore.html"><code class="docutils literal"><span class="pre">semaphore</span></code> &#8211; Semaphore classes</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/timeout.html"><code class="docutils literal"><span class="pre">timeout</span></code> &#8211; Universal Timeouts</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/websocket.html"><code class="docutils literal"><span class="pre">websocket</span></code> &#8211; Websocket Server</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/wsgi.html"><code class="docutils literal"><span class="pre">wsgi</span></code> &#8211; WSGI server</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/zmq.html"><code class="docutils literal"><span class="pre">eventlet.green.zmq</span></code> &#8211; ØMQ support</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/zmq.html#zmq-the-pyzmq-omq-python-bindings"><code class="docutils literal"><span class="pre">zmq</span></code> &#8211; The pyzmq ØMQ python bindings</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="authors.html">Authors</a><ul>
@ -172,9 +172,9 @@
<div class="section" id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li><a class="reference internal" href="genindex.html"><em>Index</em></a></li>
<li><a class="reference internal" href="py-modindex.html"><em>Module Index</em></a></li>
<li><a class="reference internal" href="search.html"><em>Search Page</em></a></li>
<li><a class="reference internal" href="genindex.html"><span>Index</span></a></li>
<li><a class="reference internal" href="py-modindex.html"><span>Module Index</span></a></li>
<li><a class="reference internal" href="search.html"><span>Search Page</span></a></li>
</ul>
</div>
@ -182,7 +182,7 @@
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="#">Table Of Contents</a></h3>
<ul>
@ -197,12 +197,14 @@
<h4>Next topic</h4>
<p class="topless"><a href="basic_usage.html"
title="next chapter">Basic Usage</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/index.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/index.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -219,7 +221,7 @@
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -231,13 +233,13 @@
<li class="right" >
<a href="basic_usage.html" title="Basic Usage"
>next</a> |</li>
<li><a href="#">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="#">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Module Reference &mdash; Eventlet 0.16.1 documentation</title>
<title>Module Reference &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="backdoor Python interactive interpreter within a running process" href="modules/backdoor.html" />
<link rel="prev" title="Environment Variables" href="environment.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,43 +43,43 @@
<li class="right" >
<a href="environment.html" title="Environment Variables"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="module-reference">
<h1>Module Reference<a class="headerlink" href="#module-reference" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="modules/backdoor.html"><tt class="docutils literal"><span class="pre">backdoor</span></tt> &#8211; Python interactive interpreter within a running process</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/corolocal.html"><tt class="docutils literal"><span class="pre">corolocal</span></tt> &#8211; Coroutine local storage</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/debug.html"><tt class="docutils literal"><span class="pre">debug</span></tt> &#8211; Debugging tools for Eventlet</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/db_pool.html"><tt class="docutils literal"><span class="pre">db_pool</span></tt> &#8211; DBAPI 2 database connection pooling</a><ul>
<li class="toctree-l1"><a class="reference internal" href="modules/backdoor.html"><code class="docutils literal"><span class="pre">backdoor</span></code> &#8211; Python interactive interpreter within a running process</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/corolocal.html"><code class="docutils literal"><span class="pre">corolocal</span></code> &#8211; Coroutine local storage</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/debug.html"><code class="docutils literal"><span class="pre">debug</span></code> &#8211; Debugging tools for Eventlet</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/db_pool.html"><code class="docutils literal"><span class="pre">db_pool</span></code> &#8211; DBAPI 2 database connection pooling</a><ul>
<li class="toctree-l2"><a class="reference internal" href="modules/db_pool.html#constructor-arguments">Constructor Arguments</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/db_pool.html#databaseconnector">DatabaseConnector</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="modules/event.html"><tt class="docutils literal"><span class="pre">event</span></tt> &#8211; Cross-greenthread primitive</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/greenpool.html"><tt class="docutils literal"><span class="pre">greenpool</span></tt> &#8211; Green Thread Pools</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/greenthread.html"><tt class="docutils literal"><span class="pre">greenthread</span></tt> &#8211; Green Thread Implementation</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/pools.html"><tt class="docutils literal"><span class="pre">pools</span></tt> - Generic pools of resources</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/queue.html"><tt class="docutils literal"><span class="pre">queue</span></tt> &#8211; Queue class</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/semaphore.html"><tt class="docutils literal"><span class="pre">semaphore</span></tt> &#8211; Semaphore classes</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/timeout.html"><tt class="docutils literal"><span class="pre">timeout</span></tt> &#8211; Universal Timeouts</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/websocket.html"><tt class="docutils literal"><span class="pre">websocket</span></tt> &#8211; Websocket Server</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/wsgi.html"><tt class="docutils literal"><span class="pre">wsgi</span></tt> &#8211; WSGI server</a><ul>
<li class="toctree-l1"><a class="reference internal" href="modules/event.html"><code class="docutils literal"><span class="pre">event</span></code> &#8211; Cross-greenthread primitive</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/greenpool.html"><code class="docutils literal"><span class="pre">greenpool</span></code> &#8211; Green Thread Pools</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/greenthread.html"><code class="docutils literal"><span class="pre">greenthread</span></code> &#8211; Green Thread Implementation</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/pools.html"><code class="docutils literal"><span class="pre">pools</span></code> - Generic pools of resources</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/queue.html"><code class="docutils literal"><span class="pre">queue</span></code> &#8211; Queue class</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/semaphore.html"><code class="docutils literal"><span class="pre">semaphore</span></code> &#8211; Semaphore classes</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/timeout.html"><code class="docutils literal"><span class="pre">timeout</span></code> &#8211; Universal Timeouts</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/websocket.html"><code class="docutils literal"><span class="pre">websocket</span></code> &#8211; Websocket Server</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/wsgi.html"><code class="docutils literal"><span class="pre">wsgi</span></code> &#8211; WSGI server</a><ul>
<li class="toctree-l2"><a class="reference internal" href="modules/wsgi.html#ssl">SSL</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/wsgi.html#non-standard-extension-to-support-post-hooks">Non-Standard Extension to Support Post Hooks</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/wsgi.html#continue-response-headers">&#8220;100 Continue&#8221; Response Headers</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="modules/zmq.html"><tt class="docutils literal"><span class="pre">eventlet.green.zmq</span></tt> &#8211; ØMQ support</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/zmq.html#zmq-the-pyzmq-omq-python-bindings"><tt class="docutils literal"><span class="pre">zmq</span></tt> &#8211; The pyzmq ØMQ python bindings</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/zmq.html"><code class="docutils literal"><span class="pre">eventlet.green.zmq</span></code> &#8211; ØMQ support</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/zmq.html#zmq-the-pyzmq-omq-python-bindings"><code class="docutils literal"><span class="pre">zmq</span></code> &#8211; The pyzmq ØMQ python bindings</a></li>
</ul>
</div>
</div>
@ -88,20 +88,22 @@
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="environment.html"
title="previous chapter">Environment Variables</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="modules/backdoor.html"
title="next chapter"><tt class="docutils literal"><span class="pre">backdoor</span></tt> &#8211; Python interactive interpreter within a running process</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/modules.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">backdoor</span></code> &#8211; Python interactive interpreter within a running process</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/modules.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -118,7 +120,7 @@
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -133,13 +135,13 @@
<li class="right" >
<a href="environment.html" title="Environment Variables"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>backdoor Python interactive interpreter within a running process &mdash; Eventlet 0.16.1 documentation</title>
<title>backdoor Python interactive interpreter within a running process &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="corolocal Coroutine local storage" href="corolocal.html" />
<link rel="prev" title="Module Reference" href="../modules.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,18 +44,18 @@
<li class="right" >
<a href="../modules.html" title="Module Reference"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="backdoor-python-interactive-interpreter-within-a-running-process">
<h1><tt class="xref py py-mod docutils literal"><span class="pre">backdoor</span></tt> &#8211; Python interactive interpreter within a running process<a class="headerlink" href="#backdoor-python-interactive-interpreter-within-a-running-process" title="Permalink to this headline"></a></h1>
<h1><code class="xref py py-mod docutils literal"><span class="pre">backdoor</span></code> &#8211; Python interactive interpreter within a running process<a class="headerlink" href="#backdoor-python-interactive-interpreter-within-a-running-process" title="Permalink to this headline"></a></h1>
<p>The backdoor module is convenient for inspecting the state of a long-running process. It supplies the normal Python interactive interpreter in a way that does not block the normal operation of the application. This can be useful for debugging, performance tuning, or simply learning about how things behave in situ.</p>
<p>In the application, spawn a greenthread running backdoor_server on a listening socket:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">eventlet</span><span class="o">.</span><span class="n">spawn</span><span class="p">(</span><span class="n">backdoor</span><span class="o">.</span><span class="n">backdoor_server</span><span class="p">,</span> <span class="n">eventlet</span><span class="o">.</span><span class="n">listen</span><span class="p">((</span><span class="s">&#39;localhost&#39;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">)))</span>
@ -63,9 +63,9 @@
</div>
<p>When this is running, the backdoor is accessible via telnet to the specified port.</p>
<div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ </span>telnet localhost 3000
Python 2.6.2 <span class="o">(</span>r262:71600, Apr 16 2009, 09:17:39<span class="o">)</span>
Python 2.6.2 <span class="o">(</span>r262:71600, Apr <span class="m">16</span> 2009, 09:17:39<span class="o">)</span>
<span class="o">[</span>GCC 4.0.1 <span class="o">(</span>Apple Computer, Inc. build 5250<span class="o">)]</span> on darwin
Type <span class="s2">&quot;help&quot;</span>, <span class="s2">&quot;copyright&quot;</span>, <span class="s2">&quot;credits&quot;</span> or <span class="s2">&quot;license&quot;</span> <span class="k">for </span>more information.
Type <span class="s2">&quot;help&quot;</span>, <span class="s2">&quot;copyright&quot;</span>, <span class="s2">&quot;credits&quot;</span> or <span class="s2">&quot;license&quot;</span> <span class="k">for</span> more information.
&gt;&gt;&gt; import myapp
&gt;&gt;&gt; dir<span class="o">(</span>myapp<span class="o">)</span>
<span class="o">[</span><span class="s1">&#39;__all__&#39;</span>, <span class="s1">&#39;__doc__&#39;</span>, <span class="s1">&#39;__name__&#39;</span>, <span class="s1">&#39;myfunc&#39;</span><span class="o">]</span>
@ -75,7 +75,7 @@ Type <span class="s2">&quot;help&quot;</span>, <span class="s2">&quot;copyright&
<p>The backdoor cooperatively yields to the rest of the application between commands, so on a running server continuously serving requests, you can observe the internal state changing between interpreter commands.</p>
<span class="target" id="module-eventlet.backdoor"></span><dl class="function">
<dt id="eventlet.backdoor.backdoor">
<tt class="descclassname">eventlet.backdoor.</tt><tt class="descname">backdoor</tt><big>(</big><em>conn_info</em>, <em>locals=None</em><big>)</big><a class="headerlink" href="#eventlet.backdoor.backdoor" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.backdoor.</code><code class="descname">backdoor</code><span class="sig-paren">(</span><em>conn_info</em>, <em>locals=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.backdoor.backdoor" title="Permalink to this definition"></a></dt>
<dd><p>Sets up an interactive console on a socket with a single connected
client. This does not block the caller, as it spawns a new greenlet to
handle the console. This is meant to be called from within an accept loop
@ -84,7 +84,7 @@ handle the console. This is meant to be called from within an accept loop
<dl class="function">
<dt id="eventlet.backdoor.backdoor_server">
<tt class="descclassname">eventlet.backdoor.</tt><tt class="descname">backdoor_server</tt><big>(</big><em>sock</em>, <em>locals=None</em><big>)</big><a class="headerlink" href="#eventlet.backdoor.backdoor_server" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.backdoor.</code><code class="descname">backdoor_server</code><span class="sig-paren">(</span><em>sock</em>, <em>locals=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.backdoor.backdoor_server" title="Permalink to this definition"></a></dt>
<dd><p>Blocking function that runs a backdoor server on the socket <em>sock</em>,
accepting connections and running backdoor consoles for each client that
connects.</p>
@ -99,20 +99,22 @@ variables in here.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="../modules.html"
title="previous chapter">Module Reference</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="corolocal.html"
title="next chapter"><tt class="docutils literal"><span class="pre">corolocal</span></tt> &#8211; Coroutine local storage</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/backdoor.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">corolocal</span></code> &#8211; Coroutine local storage</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/backdoor.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -129,7 +131,7 @@ variables in here.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -144,14 +146,14 @@ variables in here.</p>
<li class="right" >
<a href="../modules.html" title="Module Reference"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>corolocal Coroutine local storage &mdash; Eventlet 0.16.1 documentation</title>
<title>corolocal Coroutine local storage &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="debug Debugging tools for Eventlet" href="debug.html" />
<link rel="prev" title="backdoor Python interactive interpreter within a running process" href="backdoor.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,27 +44,27 @@
<li class="right" >
<a href="backdoor.html" title="backdoor Python interactive interpreter within a running process"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="module-eventlet.corolocal">
<span id="corolocal-coroutine-local-storage"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">corolocal</span></tt> &#8211; Coroutine local storage<a class="headerlink" href="#module-eventlet.corolocal" title="Permalink to this headline"></a></h1>
<span id="corolocal-coroutine-local-storage"></span><h1><code class="xref py py-mod docutils literal"><span class="pre">corolocal</span></code> &#8211; Coroutine local storage<a class="headerlink" href="#module-eventlet.corolocal" title="Permalink to this headline"></a></h1>
<dl class="function">
<dt id="eventlet.corolocal.get_ident">
<tt class="descclassname">eventlet.corolocal.</tt><tt class="descname">get_ident</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.corolocal.get_ident" title="Permalink to this definition"></a></dt>
<dd><p>Returns <tt class="docutils literal"><span class="pre">id()</span></tt> of current greenlet. Useful for debugging.</p>
<code class="descclassname">eventlet.corolocal.</code><code class="descname">get_ident</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.corolocal.get_ident" title="Permalink to this definition"></a></dt>
<dd><p>Returns <code class="docutils literal"><span class="pre">id()</span></code> of current greenlet. Useful for debugging.</p>
</dd></dl>
<dl class="class">
<dt id="eventlet.corolocal.local">
<em class="property">class </em><tt class="descclassname">eventlet.corolocal.</tt><tt class="descname">local</tt><a class="headerlink" href="#eventlet.corolocal.local" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.corolocal.</code><code class="descname">local</code><a class="headerlink" href="#eventlet.corolocal.local" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
@ -73,20 +73,22 @@
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="backdoor.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">backdoor</span></tt> &#8211; Python interactive interpreter within a running process</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">backdoor</span></code> &#8211; Python interactive interpreter within a running process</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="debug.html"
title="next chapter"><tt class="docutils literal"><span class="pre">debug</span></tt> &#8211; Debugging tools for Eventlet</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/corolocal.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">debug</span></code> &#8211; Debugging tools for Eventlet</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/corolocal.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -103,7 +105,7 @@
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -118,14 +120,14 @@
<li class="right" >
<a href="backdoor.html" title="backdoor Python interactive interpreter within a running process"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>db_pool DBAPI 2 database connection pooling &mdash; Eventlet 0.16.1 documentation</title>
<title>db_pool DBAPI 2 database connection pooling &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="event Cross-greenthread primitive" href="event.html" />
<link rel="prev" title="debug Debugging tools for Eventlet" href="debug.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,18 +44,18 @@
<li class="right" >
<a href="debug.html" title="debug Debugging tools for Eventlet"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="db-pool-dbapi-2-database-connection-pooling">
<h1><tt class="xref py py-mod docutils literal"><span class="pre">db_pool</span></tt> &#8211; DBAPI 2 database connection pooling<a class="headerlink" href="#db-pool-dbapi-2-database-connection-pooling" title="Permalink to this headline"></a></h1>
<h1><code class="xref py py-mod docutils literal"><span class="pre">db_pool</span></code> &#8211; DBAPI 2 database connection pooling<a class="headerlink" href="#db-pool-dbapi-2-database-connection-pooling" title="Permalink to this headline"></a></h1>
<p>The db_pool module is useful for managing database connections. It provides three primary benefits: cooperative yielding during database operations, concurrency limiting to a database host, and connection reuse. db_pool is intended to be database-agnostic, compatible with any DB-API 2.0 database module.</p>
<p><em>It has currently been tested and used with both MySQLdb and psycopg2.</em></p>
<p>A ConnectionPool object represents a pool of connections open to a particular database. The arguments to the constructor include the database-software-specific module, the host name, and the credentials required for authentication. After construction, the ConnectionPool object decides when to create and sever connections with the target database.</p>
@ -63,7 +63,7 @@
<span class="gp">&gt;&gt;&gt; </span><span class="n">cp</span> <span class="o">=</span> <span class="n">ConnectionPool</span><span class="p">(</span><span class="n">MySQLdb</span><span class="p">,</span> <span class="n">host</span><span class="o">=</span><span class="s">&#39;localhost&#39;</span><span class="p">,</span> <span class="n">user</span><span class="o">=</span><span class="s">&#39;root&#39;</span><span class="p">,</span> <span class="n">passwd</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>Once you have this pool object, you connect to the database by calling <tt class="xref py py-meth docutils literal"><span class="pre">get()</span></tt> on it:</p>
<p>Once you have this pool object, you connect to the database by calling <code class="xref py py-meth docutils literal"><span class="pre">get()</span></code> on it:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">conn</span> <span class="o">=</span> <span class="n">cp</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>
</pre></div>
</div>
@ -107,55 +107,55 @@
<p><em>Caveat: The DatabaseConnector is a bit unfinished, it only suits a subset of use cases.</em></p>
<span class="target" id="module-eventlet.db_pool"></span><dl class="class">
<dt id="eventlet.db_pool.BaseConnectionPool">
<em class="property">class </em><tt class="descclassname">eventlet.db_pool.</tt><tt class="descname">BaseConnectionPool</tt><big>(</big><em>db_module</em>, <em>min_size=0</em>, <em>max_size=4</em>, <em>max_idle=10</em>, <em>max_age=30</em>, <em>connect_timeout=5</em>, <em>cleanup=&lt;function cleanup_rollback at 0x7f8e1d7521b8&gt;</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.BaseConnectionPool" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.db_pool.</code><code class="descname">BaseConnectionPool</code><span class="sig-paren">(</span><em>db_module</em>, <em>min_size=0</em>, <em>max_size=4</em>, <em>max_idle=10</em>, <em>max_age=30</em>, <em>connect_timeout=5</em>, <em>cleanup=&lt;function cleanup_rollback&gt;</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.BaseConnectionPool" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="eventlet.db_pool.BaseConnectionPool.clear">
<tt class="descname">clear</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.db_pool.BaseConnectionPool.clear" title="Permalink to this definition"></a></dt>
<code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.BaseConnectionPool.clear" title="Permalink to this definition"></a></dt>
<dd><p>Close all connections that this pool still holds a reference to,
and removes all references to them.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.BaseConnectionPool.get">
<tt class="descname">get</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.db_pool.BaseConnectionPool.get" title="Permalink to this definition"></a></dt>
<code class="descname">get</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.BaseConnectionPool.get" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.BaseConnectionPool.item">
<tt class="descname">item</tt><big>(</big><em>*args</em>, <em>**kwds</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.BaseConnectionPool.item" title="Permalink to this definition"></a></dt>
<code class="descname">item</code><span class="sig-paren">(</span><em>cleanup=&lt;object object&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.BaseConnectionPool.item" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.BaseConnectionPool.put">
<tt class="descname">put</tt><big>(</big><em>conn</em>, <em>cleanup=&lt;object object at 0x7f8e1d7d5640&gt;</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.BaseConnectionPool.put" title="Permalink to this definition"></a></dt>
<code class="descname">put</code><span class="sig-paren">(</span><em>conn</em>, <em>cleanup=&lt;object object&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.BaseConnectionPool.put" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="eventlet.db_pool.ConnectTimeout">
<em class="property">exception </em><tt class="descclassname">eventlet.db_pool.</tt><tt class="descname">ConnectTimeout</tt><a class="headerlink" href="#eventlet.db_pool.ConnectTimeout" title="Permalink to this definition"></a></dt>
<em class="property">exception </em><code class="descclassname">eventlet.db_pool.</code><code class="descname">ConnectTimeout</code><a class="headerlink" href="#eventlet.db_pool.ConnectTimeout" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="eventlet.db_pool.ConnectionPool">
<tt class="descclassname">eventlet.db_pool.</tt><tt class="descname">ConnectionPool</tt><a class="headerlink" href="#eventlet.db_pool.ConnectionPool" title="Permalink to this definition"></a></dt>
<dd><p>alias of <a class="reference internal" href="#eventlet.db_pool.TpooledConnectionPool" title="eventlet.db_pool.TpooledConnectionPool"><tt class="xref py py-class docutils literal"><span class="pre">TpooledConnectionPool</span></tt></a></p>
<code class="descclassname">eventlet.db_pool.</code><code class="descname">ConnectionPool</code><a class="headerlink" href="#eventlet.db_pool.ConnectionPool" title="Permalink to this definition"></a></dt>
<dd><p>alias of <a class="reference internal" href="#eventlet.db_pool.TpooledConnectionPool" title="eventlet.db_pool.TpooledConnectionPool"><code class="xref py py-class docutils literal"><span class="pre">TpooledConnectionPool</span></code></a></p>
</dd></dl>
<dl class="class">
<dt id="eventlet.db_pool.DatabaseConnector">
<em class="property">class </em><tt class="descclassname">eventlet.db_pool.</tt><tt class="descname">DatabaseConnector</tt><big>(</big><em>module</em>, <em>credentials</em>, <em>conn_pool=None</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.DatabaseConnector" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.db_pool.</code><code class="descname">DatabaseConnector</code><span class="sig-paren">(</span><em>module</em>, <em>credentials</em>, <em>conn_pool=None</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.DatabaseConnector" title="Permalink to this definition"></a></dt>
<dd><p>This is an object which will maintain a collection of database
connection pools on a per-host basis.</p>
<dl class="method">
<dt id="eventlet.db_pool.DatabaseConnector.credentials_for">
<tt class="descname">credentials_for</tt><big>(</big><em>host</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.DatabaseConnector.credentials_for" title="Permalink to this definition"></a></dt>
<code class="descname">credentials_for</code><span class="sig-paren">(</span><em>host</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.DatabaseConnector.credentials_for" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.DatabaseConnector.get">
<tt class="descname">get</tt><big>(</big><em>host</em>, <em>dbname</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.DatabaseConnector.get" title="Permalink to this definition"></a></dt>
<code class="descname">get</code><span class="sig-paren">(</span><em>host</em>, <em>dbname</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.DatabaseConnector.get" title="Permalink to this definition"></a></dt>
<dd><p>Returns a ConnectionPool to the target host and schema.</p>
</dd></dl>
@ -163,174 +163,174 @@ connection pools on a per-host basis.</p>
<dl class="class">
<dt id="eventlet.db_pool.GenericConnectionWrapper">
<em class="property">class </em><tt class="descclassname">eventlet.db_pool.</tt><tt class="descname">GenericConnectionWrapper</tt><big>(</big><em>baseconn</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.db_pool.</code><code class="descname">GenericConnectionWrapper</code><span class="sig-paren">(</span><em>baseconn</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.affected_rows">
<tt class="descname">affected_rows</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.affected_rows" title="Permalink to this definition"></a></dt>
<code class="descname">affected_rows</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.affected_rows" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.autocommit">
<tt class="descname">autocommit</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.autocommit" title="Permalink to this definition"></a></dt>
<code class="descname">autocommit</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.autocommit" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.begin">
<tt class="descname">begin</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.begin" title="Permalink to this definition"></a></dt>
<code class="descname">begin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.begin" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.change_user">
<tt class="descname">change_user</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.change_user" title="Permalink to this definition"></a></dt>
<code class="descname">change_user</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.change_user" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.character_set_name">
<tt class="descname">character_set_name</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.character_set_name" title="Permalink to this definition"></a></dt>
<code class="descname">character_set_name</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.character_set_name" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.close">
<tt class="descname">close</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.close" title="Permalink to this definition"></a></dt>
<code class="descname">close</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.close" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.commit">
<tt class="descname">commit</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.commit" title="Permalink to this definition"></a></dt>
<code class="descname">commit</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.commit" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.cursor">
<tt class="descname">cursor</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.cursor" title="Permalink to this definition"></a></dt>
<code class="descname">cursor</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.cursor" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.dump_debug_info">
<tt class="descname">dump_debug_info</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.dump_debug_info" title="Permalink to this definition"></a></dt>
<code class="descname">dump_debug_info</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.dump_debug_info" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.errno">
<tt class="descname">errno</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.errno" title="Permalink to this definition"></a></dt>
<code class="descname">errno</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.errno" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.error">
<tt class="descname">error</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.error" title="Permalink to this definition"></a></dt>
<code class="descname">error</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.error" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.errorhandler">
<tt class="descname">errorhandler</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.errorhandler" title="Permalink to this definition"></a></dt>
<code class="descname">errorhandler</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.errorhandler" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.insert_id">
<tt class="descname">insert_id</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.insert_id" title="Permalink to this definition"></a></dt>
<code class="descname">insert_id</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.insert_id" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.literal">
<tt class="descname">literal</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.literal" title="Permalink to this definition"></a></dt>
<code class="descname">literal</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.literal" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.ping">
<tt class="descname">ping</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.ping" title="Permalink to this definition"></a></dt>
<code class="descname">ping</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.ping" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.query">
<tt class="descname">query</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.query" title="Permalink to this definition"></a></dt>
<code class="descname">query</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.query" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.rollback">
<tt class="descname">rollback</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.rollback" title="Permalink to this definition"></a></dt>
<code class="descname">rollback</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.rollback" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.select_db">
<tt class="descname">select_db</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.select_db" title="Permalink to this definition"></a></dt>
<code class="descname">select_db</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.select_db" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.server_capabilities">
<tt class="descname">server_capabilities</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.server_capabilities" title="Permalink to this definition"></a></dt>
<code class="descname">server_capabilities</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.server_capabilities" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.set_character_set">
<tt class="descname">set_character_set</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.set_character_set" title="Permalink to this definition"></a></dt>
<code class="descname">set_character_set</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.set_character_set" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.set_server_option">
<tt class="descname">set_server_option</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.set_server_option" title="Permalink to this definition"></a></dt>
<code class="descname">set_server_option</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.set_server_option" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.set_sql_mode">
<tt class="descname">set_sql_mode</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.set_sql_mode" title="Permalink to this definition"></a></dt>
<code class="descname">set_sql_mode</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.set_sql_mode" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.show_warnings">
<tt class="descname">show_warnings</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.show_warnings" title="Permalink to this definition"></a></dt>
<code class="descname">show_warnings</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.show_warnings" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.shutdown">
<tt class="descname">shutdown</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.shutdown" title="Permalink to this definition"></a></dt>
<code class="descname">shutdown</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.shutdown" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.sqlstate">
<tt class="descname">sqlstate</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.sqlstate" title="Permalink to this definition"></a></dt>
<code class="descname">sqlstate</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.sqlstate" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.stat">
<tt class="descname">stat</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.stat" title="Permalink to this definition"></a></dt>
<code class="descname">stat</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.stat" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.store_result">
<tt class="descname">store_result</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.store_result" title="Permalink to this definition"></a></dt>
<code class="descname">store_result</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.store_result" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.string_literal">
<tt class="descname">string_literal</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.string_literal" title="Permalink to this definition"></a></dt>
<code class="descname">string_literal</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.string_literal" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.thread_id">
<tt class="descname">thread_id</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.thread_id" title="Permalink to this definition"></a></dt>
<code class="descname">thread_id</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.thread_id" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.use_result">
<tt class="descname">use_result</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.use_result" title="Permalink to this definition"></a></dt>
<code class="descname">use_result</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.use_result" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.GenericConnectionWrapper.warning_count">
<tt class="descname">warning_count</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.warning_count" title="Permalink to this definition"></a></dt>
<code class="descname">warning_count</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.GenericConnectionWrapper.warning_count" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="eventlet.db_pool.PooledConnectionWrapper">
<em class="property">class </em><tt class="descclassname">eventlet.db_pool.</tt><tt class="descname">PooledConnectionWrapper</tt><big>(</big><em>baseconn</em>, <em>pool</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.PooledConnectionWrapper" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.db_pool.</code><code class="descname">PooledConnectionWrapper</code><span class="sig-paren">(</span><em>baseconn</em>, <em>pool</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.PooledConnectionWrapper" title="Permalink to this definition"></a></dt>
<dd><p>A connection wrapper where:
- the close method returns the connection to the pool instead of closing it directly
- <tt class="docutils literal"><span class="pre">bool(conn)</span></tt> returns a reasonable value
- <code class="docutils literal"><span class="pre">bool(conn)</span></code> returns a reasonable value
- returns itself to the pool if it gets garbage collected</p>
<dl class="method">
<dt id="eventlet.db_pool.PooledConnectionWrapper.close">
<tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.db_pool.PooledConnectionWrapper.close" title="Permalink to this definition"></a></dt>
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.PooledConnectionWrapper.close" title="Permalink to this definition"></a></dt>
<dd><p>Return the connection to the pool, and remove the
reference to it so that you can&#8217;t use it again through this
wrapper object.</p>
@ -340,40 +340,40 @@ wrapper object.</p>
<dl class="class">
<dt id="eventlet.db_pool.RawConnectionPool">
<em class="property">class </em><tt class="descclassname">eventlet.db_pool.</tt><tt class="descname">RawConnectionPool</tt><big>(</big><em>db_module</em>, <em>min_size=0</em>, <em>max_size=4</em>, <em>max_idle=10</em>, <em>max_age=30</em>, <em>connect_timeout=5</em>, <em>cleanup=&lt;function cleanup_rollback at 0x7f8e1d7521b8&gt;</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.RawConnectionPool" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.db_pool.</code><code class="descname">RawConnectionPool</code><span class="sig-paren">(</span><em>db_module</em>, <em>min_size=0</em>, <em>max_size=4</em>, <em>max_idle=10</em>, <em>max_age=30</em>, <em>connect_timeout=5</em>, <em>cleanup=&lt;function cleanup_rollback&gt;</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.RawConnectionPool" title="Permalink to this definition"></a></dt>
<dd><p>A pool which gives out plain database connections.</p>
<dl class="classmethod">
<dt id="eventlet.db_pool.RawConnectionPool.connect">
<em class="property">classmethod </em><tt class="descname">connect</tt><big>(</big><em>db_module</em>, <em>connect_timeout</em>, <em>*args</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.RawConnectionPool.connect" title="Permalink to this definition"></a></dt>
<em class="property">classmethod </em><code class="descname">connect</code><span class="sig-paren">(</span><em>db_module</em>, <em>connect_timeout</em>, <em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.RawConnectionPool.connect" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.RawConnectionPool.create">
<tt class="descname">create</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.db_pool.RawConnectionPool.create" title="Permalink to this definition"></a></dt>
<code class="descname">create</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.RawConnectionPool.create" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="eventlet.db_pool.TpooledConnectionPool">
<em class="property">class </em><tt class="descclassname">eventlet.db_pool.</tt><tt class="descname">TpooledConnectionPool</tt><big>(</big><em>db_module</em>, <em>min_size=0</em>, <em>max_size=4</em>, <em>max_idle=10</em>, <em>max_age=30</em>, <em>connect_timeout=5</em>, <em>cleanup=&lt;function cleanup_rollback at 0x7f8e1d7521b8&gt;</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.TpooledConnectionPool" title="Permalink to this definition"></a></dt>
<dd><p>A pool which gives out <a class="reference internal" href="../threading.html#eventlet.tpool.Proxy" title="eventlet.tpool.Proxy"><tt class="xref py py-class docutils literal"><span class="pre">Proxy</span></tt></a>-based database
<em class="property">class </em><code class="descclassname">eventlet.db_pool.</code><code class="descname">TpooledConnectionPool</code><span class="sig-paren">(</span><em>db_module</em>, <em>min_size=0</em>, <em>max_size=4</em>, <em>max_idle=10</em>, <em>max_age=30</em>, <em>connect_timeout=5</em>, <em>cleanup=&lt;function cleanup_rollback&gt;</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.TpooledConnectionPool" title="Permalink to this definition"></a></dt>
<dd><p>A pool which gives out <a class="reference internal" href="../threading.html#eventlet.tpool.Proxy" title="eventlet.tpool.Proxy"><code class="xref py py-class docutils literal"><span class="pre">Proxy</span></code></a>-based database
connections.</p>
<dl class="classmethod">
<dt id="eventlet.db_pool.TpooledConnectionPool.connect">
<em class="property">classmethod </em><tt class="descname">connect</tt><big>(</big><em>db_module</em>, <em>connect_timeout</em>, <em>*args</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.TpooledConnectionPool.connect" title="Permalink to this definition"></a></dt>
<em class="property">classmethod </em><code class="descname">connect</code><span class="sig-paren">(</span><em>db_module</em>, <em>connect_timeout</em>, <em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.TpooledConnectionPool.connect" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="eventlet.db_pool.TpooledConnectionPool.create">
<tt class="descname">create</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.db_pool.TpooledConnectionPool.create" title="Permalink to this definition"></a></dt>
<code class="descname">create</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.TpooledConnectionPool.create" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="eventlet.db_pool.cleanup_rollback">
<tt class="descclassname">eventlet.db_pool.</tt><tt class="descname">cleanup_rollback</tt><big>(</big><em>conn</em><big>)</big><a class="headerlink" href="#eventlet.db_pool.cleanup_rollback" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.db_pool.</code><code class="descname">cleanup_rollback</code><span class="sig-paren">(</span><em>conn</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.db_pool.cleanup_rollback" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
@ -383,11 +383,11 @@ connections.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><tt class="docutils literal"><span class="pre">db_pool</span></tt> &#8211; DBAPI 2 database connection pooling</a><ul>
<li><a class="reference internal" href="#"><code class="docutils literal"><span class="pre">db_pool</span></code> &#8211; DBAPI 2 database connection pooling</a><ul>
<li><a class="reference internal" href="#constructor-arguments">Constructor Arguments</a></li>
<li><a class="reference internal" href="#databaseconnector">DatabaseConnector</a></li>
</ul>
@ -396,16 +396,18 @@ connections.</p>
<h4>Previous topic</h4>
<p class="topless"><a href="debug.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">debug</span></tt> &#8211; Debugging tools for Eventlet</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">debug</span></code> &#8211; Debugging tools for Eventlet</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="event.html"
title="next chapter"><tt class="docutils literal"><span class="pre">event</span></tt> &#8211; Cross-greenthread primitive</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/db_pool.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">event</span></code> &#8211; Cross-greenthread primitive</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/db_pool.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -422,7 +424,7 @@ connections.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -437,14 +439,14 @@ connections.</p>
<li class="right" >
<a href="debug.html" title="debug Debugging tools for Eventlet"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>debug Debugging tools for Eventlet &mdash; Eventlet 0.16.1 documentation</title>
<title>debug Debugging tools for Eventlet &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="db_pool DBAPI 2 database connection pooling" href="db_pool.html" />
<link rel="prev" title="corolocal Coroutine local storage" href="corolocal.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,69 +44,69 @@
<li class="right" >
<a href="corolocal.html" title="corolocal Coroutine local storage"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="module-eventlet.debug">
<span id="debug-debugging-tools-for-eventlet"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">debug</span></tt> &#8211; Debugging tools for Eventlet<a class="headerlink" href="#module-eventlet.debug" title="Permalink to this headline"></a></h1>
<span id="debug-debugging-tools-for-eventlet"></span><h1><code class="xref py py-mod docutils literal"><span class="pre">debug</span></code> &#8211; Debugging tools for Eventlet<a class="headerlink" href="#module-eventlet.debug" title="Permalink to this headline"></a></h1>
<p>The debug module contains utilities and functions for better
debugging Eventlet-powered applications.</p>
<dl class="function">
<dt id="eventlet.debug.spew">
<tt class="descclassname">eventlet.debug.</tt><tt class="descname">spew</tt><big>(</big><em>trace_names=None</em>, <em>show_values=False</em><big>)</big><a class="headerlink" href="#eventlet.debug.spew" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.debug.</code><code class="descname">spew</code><span class="sig-paren">(</span><em>trace_names=None</em>, <em>show_values=False</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.debug.spew" title="Permalink to this definition"></a></dt>
<dd><p>Install a trace hook which writes incredibly detailed logs
about what code is being executed to stdout.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.unspew">
<tt class="descclassname">eventlet.debug.</tt><tt class="descname">unspew</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.debug.unspew" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.debug.</code><code class="descname">unspew</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.debug.unspew" title="Permalink to this definition"></a></dt>
<dd><p>Remove the trace hook installed by spew.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.format_hub_listeners">
<tt class="descclassname">eventlet.debug.</tt><tt class="descname">format_hub_listeners</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.debug.format_hub_listeners" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.debug.</code><code class="descname">format_hub_listeners</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.debug.format_hub_listeners" title="Permalink to this definition"></a></dt>
<dd><p>Returns a formatted string of the current listeners on the current
hub. This can be useful in determining what&#8217;s going on in the event system,
especially when used in conjunction with <a class="reference internal" href="#eventlet.debug.hub_listener_stacks" title="eventlet.debug.hub_listener_stacks"><tt class="xref py py-func docutils literal"><span class="pre">hub_listener_stacks()</span></tt></a>.</p>
especially when used in conjunction with <a class="reference internal" href="#eventlet.debug.hub_listener_stacks" title="eventlet.debug.hub_listener_stacks"><code class="xref py py-func docutils literal"><span class="pre">hub_listener_stacks()</span></code></a>.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.format_hub_timers">
<tt class="descclassname">eventlet.debug.</tt><tt class="descname">format_hub_timers</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.debug.format_hub_timers" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.debug.</code><code class="descname">format_hub_timers</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.debug.format_hub_timers" title="Permalink to this definition"></a></dt>
<dd><p>Returns a formatted string of the current timers on the current
hub. This can be useful in determining what&#8217;s going on in the event system,
especially when used in conjunction with <a class="reference internal" href="#eventlet.debug.hub_timer_stacks" title="eventlet.debug.hub_timer_stacks"><tt class="xref py py-func docutils literal"><span class="pre">hub_timer_stacks()</span></tt></a>.</p>
especially when used in conjunction with <a class="reference internal" href="#eventlet.debug.hub_timer_stacks" title="eventlet.debug.hub_timer_stacks"><code class="xref py py-func docutils literal"><span class="pre">hub_timer_stacks()</span></code></a>.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.hub_listener_stacks">
<tt class="descclassname">eventlet.debug.</tt><tt class="descname">hub_listener_stacks</tt><big>(</big><em>state=False</em><big>)</big><a class="headerlink" href="#eventlet.debug.hub_listener_stacks" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.debug.</code><code class="descname">hub_listener_stacks</code><span class="sig-paren">(</span><em>state=False</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.debug.hub_listener_stacks" title="Permalink to this definition"></a></dt>
<dd><p>Toggles whether or not the hub records the stack when clients register
listeners on file descriptors. This can be useful when trying to figure
out what the hub is up to at any given moment. To inspect the stacks
of the current listeners, call <a class="reference internal" href="#eventlet.debug.format_hub_listeners" title="eventlet.debug.format_hub_listeners"><tt class="xref py py-func docutils literal"><span class="pre">format_hub_listeners()</span></tt></a> at critical
of the current listeners, call <a class="reference internal" href="#eventlet.debug.format_hub_listeners" title="eventlet.debug.format_hub_listeners"><code class="xref py py-func docutils literal"><span class="pre">format_hub_listeners()</span></code></a> at critical
junctures in the application logic.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.hub_exceptions">
<tt class="descclassname">eventlet.debug.</tt><tt class="descname">hub_exceptions</tt><big>(</big><em>state=True</em><big>)</big><a class="headerlink" href="#eventlet.debug.hub_exceptions" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.debug.</code><code class="descname">hub_exceptions</code><span class="sig-paren">(</span><em>state=True</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.debug.hub_exceptions" title="Permalink to this definition"></a></dt>
<dd><p>Toggles whether the hub prints exceptions that are raised from its
timers. This can be useful to see how greenthreads are terminating.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.tpool_exceptions">
<tt class="descclassname">eventlet.debug.</tt><tt class="descname">tpool_exceptions</tt><big>(</big><em>state=False</em><big>)</big><a class="headerlink" href="#eventlet.debug.tpool_exceptions" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.debug.</code><code class="descname">tpool_exceptions</code><span class="sig-paren">(</span><em>state=False</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.debug.tpool_exceptions" title="Permalink to this definition"></a></dt>
<dd><p>Toggles whether tpool itself prints exceptions that are raised from
functions that are executed in it, in addition to raising them like
it normally does.</p>
@ -114,26 +114,26 @@ it normally does.</p>
<dl class="function">
<dt id="eventlet.debug.hub_prevent_multiple_readers">
<tt class="descclassname">eventlet.debug.</tt><tt class="descname">hub_prevent_multiple_readers</tt><big>(</big><em>state=True</em><big>)</big><a class="headerlink" href="#eventlet.debug.hub_prevent_multiple_readers" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.debug.</code><code class="descname">hub_prevent_multiple_readers</code><span class="sig-paren">(</span><em>state=True</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.debug.hub_prevent_multiple_readers" title="Permalink to this definition"></a></dt>
<dd><p>Toggle prevention of multiple greenlets reading from a socket</p>
<p>When multiple greenlets read from the same socket it is often hard
to predict which greenlet will receive what data. To achieve
resource sharing consider using <tt class="docutils literal"><span class="pre">eventlet.pools.Pool</span></tt> instead.</p>
resource sharing consider using <code class="docutils literal"><span class="pre">eventlet.pools.Pool</span></code> instead.</p>
<p>But if you really know what you are doing you can change the state
to <tt class="docutils literal"><span class="pre">False</span></tt> to stop the hub from protecting against this mistake.</p>
to <code class="docutils literal"><span class="pre">False</span></code> to stop the hub from protecting against this mistake.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.hub_timer_stacks">
<tt class="descclassname">eventlet.debug.</tt><tt class="descname">hub_timer_stacks</tt><big>(</big><em>state=False</em><big>)</big><a class="headerlink" href="#eventlet.debug.hub_timer_stacks" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.debug.</code><code class="descname">hub_timer_stacks</code><span class="sig-paren">(</span><em>state=False</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.debug.hub_timer_stacks" title="Permalink to this definition"></a></dt>
<dd><p>Toggles whether or not the hub records the stack when timers are set.
To inspect the stacks of the current timers, call <a class="reference internal" href="#eventlet.debug.format_hub_timers" title="eventlet.debug.format_hub_timers"><tt class="xref py py-func docutils literal"><span class="pre">format_hub_timers()</span></tt></a>
To inspect the stacks of the current timers, call <a class="reference internal" href="#eventlet.debug.format_hub_timers" title="eventlet.debug.format_hub_timers"><code class="xref py py-func docutils literal"><span class="pre">format_hub_timers()</span></code></a>
at critical junctures in the application logic.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.debug.hub_blocking_detection">
<tt class="descclassname">eventlet.debug.</tt><tt class="descname">hub_blocking_detection</tt><big>(</big><em>state=False</em>, <em>resolution=1</em><big>)</big><a class="headerlink" href="#eventlet.debug.hub_blocking_detection" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.debug.</code><code class="descname">hub_blocking_detection</code><span class="sig-paren">(</span><em>state=False</em>, <em>resolution=1</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.debug.hub_blocking_detection" title="Permalink to this definition"></a></dt>
<dd><p>Toggles whether Eventlet makes an effort to detect blocking
behavior in an application.</p>
<p>It does this by telling the kernel to raise a SIGALARM after a
@ -142,7 +142,7 @@ greenlet is resumed. Therefore, any code that runs for a long
time without yielding to the hub will get interrupted by the
blocking detector (don&#8217;t use it in production!).</p>
<p>The <em>resolution</em> argument governs how long the SIGALARM timeout
waits in seconds. The implementation uses <a class="reference external" href="http://docs.python.org/library/signal.html#signal.setitimer" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">signal.setitimer()</span></tt></a>
waits in seconds. The implementation uses <a class="reference external" href="http://docs.python.org/library/signal.html#signal.setitimer" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">signal.setitimer()</span></code></a>
and can be specified as a floating-point value.
The shorter the resolution, the greater the chance of false
positives.</p>
@ -154,20 +154,22 @@ positives.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="corolocal.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">corolocal</span></tt> &#8211; Coroutine local storage</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">corolocal</span></code> &#8211; Coroutine local storage</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="db_pool.html"
title="next chapter"><tt class="docutils literal"><span class="pre">db_pool</span></tt> &#8211; DBAPI 2 database connection pooling</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/debug.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">db_pool</span></code> &#8211; DBAPI 2 database connection pooling</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/debug.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -184,7 +186,7 @@ positives.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -199,14 +201,14 @@ positives.</p>
<li class="right" >
<a href="corolocal.html" title="corolocal Coroutine local storage"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>event Cross-greenthread primitive &mdash; Eventlet 0.16.1 documentation</title>
<title>event Cross-greenthread primitive &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="greenpool Green Thread Pools" href="greenpool.html" />
<link rel="prev" title="db_pool DBAPI 2 database connection pooling" href="db_pool.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,32 +44,32 @@
<li class="right" >
<a href="db_pool.html" title="db_pool DBAPI 2 database connection pooling"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="module-eventlet.event">
<span id="event-cross-greenthread-primitive"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">event</span></tt> &#8211; Cross-greenthread primitive<a class="headerlink" href="#module-eventlet.event" title="Permalink to this headline"></a></h1>
<span id="event-cross-greenthread-primitive"></span><h1><code class="xref py py-mod docutils literal"><span class="pre">event</span></code> &#8211; Cross-greenthread primitive<a class="headerlink" href="#module-eventlet.event" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="eventlet.event.Event">
<em class="property">class </em><tt class="descclassname">eventlet.event.</tt><tt class="descname">Event</tt><a class="headerlink" href="#eventlet.event.Event" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.event.</code><code class="descname">Event</code><a class="headerlink" href="#eventlet.event.Event" title="Permalink to this definition"></a></dt>
<dd><p>An abstraction where an arbitrary number of coroutines
can wait for one event from another.</p>
<p>Events are similar to a Queue that can only hold one item, but differ
in two important ways:</p>
<ol class="arabic simple">
<li>calling <a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt></a> never unschedules the current greenthread</li>
<li><a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt></a> can only be called once; create a new event to send again.</li>
<li>calling <a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><code class="xref py py-meth docutils literal"><span class="pre">send()</span></code></a> never unschedules the current greenthread</li>
<li><a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><code class="xref py py-meth docutils literal"><span class="pre">send()</span></code></a> can only be called once; create a new event to send again.</li>
</ol>
<p>They are good for communicating results between coroutines, and
are the basis for how
<a class="reference internal" href="greenthread.html#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><tt class="xref py py-meth docutils literal"><span class="pre">GreenThread.wait()</span></tt></a>
<a class="reference internal" href="greenthread.html#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><code class="xref py py-meth docutils literal"><span class="pre">GreenThread.wait()</span></code></a>
is implemented.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">event</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">eventlet</span>
@ -84,17 +84,17 @@ is implemented.</p>
</div>
<dl class="method">
<dt id="eventlet.event.Event.ready">
<tt class="descname">ready</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.event.Event.ready" title="Permalink to this definition"></a></dt>
<dd><p>Return true if the <a class="reference internal" href="#eventlet.event.Event.wait" title="eventlet.event.Event.wait"><tt class="xref py py-meth docutils literal"><span class="pre">wait()</span></tt></a> call will return immediately.
<code class="descname">ready</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.event.Event.ready" title="Permalink to this definition"></a></dt>
<dd><p>Return true if the <a class="reference internal" href="#eventlet.event.Event.wait" title="eventlet.event.Event.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a> call will return immediately.
Used to avoid waiting for things that might take a while to time out.
For example, you can put a bunch of events into a list, and then visit
them all repeatedly, calling <a class="reference internal" href="#eventlet.event.Event.ready" title="eventlet.event.Event.ready"><tt class="xref py py-meth docutils literal"><span class="pre">ready()</span></tt></a> until one returns <tt class="docutils literal"><span class="pre">True</span></tt>,
and then you can <a class="reference internal" href="#eventlet.event.Event.wait" title="eventlet.event.Event.wait"><tt class="xref py py-meth docutils literal"><span class="pre">wait()</span></tt></a> on that one.</p>
them all repeatedly, calling <a class="reference internal" href="#eventlet.event.Event.ready" title="eventlet.event.Event.ready"><code class="xref py py-meth docutils literal"><span class="pre">ready()</span></code></a> until one returns <code class="docutils literal"><span class="pre">True</span></code>,
and then you can <a class="reference internal" href="#eventlet.event.Event.wait" title="eventlet.event.Event.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a> on that one.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.event.Event.send">
<tt class="descname">send</tt><big>(</big><em>result=None</em>, <em>exc=None</em><big>)</big><a class="headerlink" href="#eventlet.event.Event.send" title="Permalink to this definition"></a></dt>
<code class="descname">send</code><span class="sig-paren">(</span><em>result=None</em>, <em>exc=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.event.Event.send" title="Permalink to this definition"></a></dt>
<dd><p>Makes arrangements for the waiters to be woken with the
result and then returns immediately to the parent.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">event</span>
@ -112,23 +112,23 @@ result and then returns immediately to the parent.</p>
<span class="go">waited for a</span>
</pre></div>
</div>
<p>It is an error to call <a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt></a> multiple times on the same event.</p>
<p>It is an error to call <a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><code class="xref py py-meth docutils literal"><span class="pre">send()</span></code></a> multiple times on the same event.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">evt</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s">&#39;whoops&#39;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">AssertionError</span>: <span class="n">Trying to re-send() an already-triggered event.</span>
</pre></div>
</div>
<p>Use <tt class="xref py py-meth docutils literal"><span class="pre">reset()</span></tt> between <a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt></a> s to reuse an event object.</p>
<p>Use <code class="xref py py-meth docutils literal"><span class="pre">reset()</span></code> between <a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><code class="xref py py-meth docutils literal"><span class="pre">send()</span></code></a> s to reuse an event object.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.event.Event.send_exception">
<tt class="descname">send_exception</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#eventlet.event.Event.send_exception" title="Permalink to this definition"></a></dt>
<dd><p>Same as <a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt></a>, but sends an exception to waiters.</p>
<code class="descname">send_exception</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.event.Event.send_exception" title="Permalink to this definition"></a></dt>
<dd><p>Same as <a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><code class="xref py py-meth docutils literal"><span class="pre">send()</span></code></a>, but sends an exception to waiters.</p>
<p>The arguments to send_exception are the same as the arguments
to <tt class="docutils literal"><span class="pre">raise</span></tt>. If a single exception object is passed in, it
will be re-raised when <a class="reference internal" href="#eventlet.event.Event.wait" title="eventlet.event.Event.wait"><tt class="xref py py-meth docutils literal"><span class="pre">wait()</span></tt></a> is called, generating a
to <code class="docutils literal"><span class="pre">raise</span></code>. If a single exception object is passed in, it
will be re-raised when <a class="reference internal" href="#eventlet.event.Event.wait" title="eventlet.event.Event.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a> is called, generating a
new stacktrace.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">event</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">evt</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">()</span>
@ -142,7 +142,7 @@ new stacktrace.</p>
</pre></div>
</div>
<p>If it&#8217;s important to preserve the entire original stack trace,
you must pass in the entire <a class="reference external" href="http://docs.python.org/library/sys.html#sys.exc_info" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">sys.exc_info()</span></tt></a> tuple.</p>
you must pass in the entire <a class="reference external" href="http://docs.python.org/library/sys.html#sys.exc_info" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">sys.exc_info()</span></code></a> tuple.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">sys</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">evt</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">try</span><span class="p">:</span>
@ -161,15 +161,15 @@ you must pass in the entire <a class="reference external" href="http://docs.pyth
</div>
<p>Note that doing so stores a traceback object directly on the
Event object, which may cause reference cycles. See the
<a class="reference external" href="http://docs.python.org/library/sys.html#sys.exc_info" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">sys.exc_info()</span></tt></a> documentation.</p>
<a class="reference external" href="http://docs.python.org/library/sys.html#sys.exc_info" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">sys.exc_info()</span></code></a> documentation.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.event.Event.wait">
<tt class="descname">wait</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.event.Event.wait" title="Permalink to this definition"></a></dt>
<dd><p>Wait until another coroutine calls <a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt></a>.
<code class="descname">wait</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.event.Event.wait" title="Permalink to this definition"></a></dt>
<dd><p>Wait until another coroutine calls <a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><code class="xref py py-meth docutils literal"><span class="pre">send()</span></code></a>.
Returns the value the other coroutine passed to
<a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt></a>.</p>
<a class="reference internal" href="#eventlet.event.Event.send" title="eventlet.event.Event.send"><code class="xref py py-meth docutils literal"><span class="pre">send()</span></code></a>.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">event</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">eventlet</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">evt</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">()</span>
@ -183,7 +183,7 @@ Returns the value the other coroutine passed to
</pre></div>
</div>
<p>Returns immediately if the event has already
occured.</p>
occurred.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">evt</span><span class="o">.</span><span class="n">wait</span><span class="p">()</span>
<span class="go">&#39;result&#39;</span>
</pre></div>
@ -198,20 +198,22 @@ occured.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="db_pool.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">db_pool</span></tt> &#8211; DBAPI 2 database connection pooling</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">db_pool</span></code> &#8211; DBAPI 2 database connection pooling</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="greenpool.html"
title="next chapter"><tt class="docutils literal"><span class="pre">greenpool</span></tt> &#8211; Green Thread Pools</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/event.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">greenpool</span></code> &#8211; Green Thread Pools</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/event.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -228,7 +230,7 @@ occured.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -243,14 +245,14 @@ occured.</p>
<li class="right" >
<a href="db_pool.html" title="db_pool DBAPI 2 database connection pooling"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>greenpool Green Thread Pools &mdash; Eventlet 0.16.1 documentation</title>
<title>greenpool Green Thread Pools &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="greenthread Green Thread Implementation" href="greenthread.html" />
<link rel="prev" title="event Cross-greenthread primitive" href="event.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,35 +44,35 @@
<li class="right" >
<a href="event.html" title="event Cross-greenthread primitive"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="module-eventlet.greenpool">
<span id="greenpool-green-thread-pools"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">greenpool</span></tt> &#8211; Green Thread Pools<a class="headerlink" href="#module-eventlet.greenpool" title="Permalink to this headline"></a></h1>
<span id="greenpool-green-thread-pools"></span><h1><code class="xref py py-mod docutils literal"><span class="pre">greenpool</span></code> &#8211; Green Thread Pools<a class="headerlink" href="#module-eventlet.greenpool" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="eventlet.greenpool.GreenPool">
<em class="property">class </em><tt class="descclassname">eventlet.greenpool.</tt><tt class="descname">GreenPool</tt><big>(</big><em>size=1000</em><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPool" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.greenpool.</code><code class="descname">GreenPool</code><span class="sig-paren">(</span><em>size=1000</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPool" title="Permalink to this definition"></a></dt>
<dd><p>The GreenPool class is a pool of green threads.</p>
<dl class="method">
<dt id="eventlet.greenpool.GreenPool.free">
<tt class="descname">free</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPool.free" title="Permalink to this definition"></a></dt>
<code class="descname">free</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPool.free" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of greenthreads available for use.</p>
<p>If zero or less, the next call to <a class="reference internal" href="#eventlet.greenpool.GreenPool.spawn" title="eventlet.greenpool.GreenPool.spawn"><tt class="xref py py-meth docutils literal"><span class="pre">spawn()</span></tt></a> or <a class="reference internal" href="#eventlet.greenpool.GreenPool.spawn_n" title="eventlet.greenpool.GreenPool.spawn_n"><tt class="xref py py-meth docutils literal"><span class="pre">spawn_n()</span></tt></a> will
<p>If zero or less, the next call to <a class="reference internal" href="#eventlet.greenpool.GreenPool.spawn" title="eventlet.greenpool.GreenPool.spawn"><code class="xref py py-meth docutils literal"><span class="pre">spawn()</span></code></a> or <a class="reference internal" href="#eventlet.greenpool.GreenPool.spawn_n" title="eventlet.greenpool.GreenPool.spawn_n"><code class="xref py py-meth docutils literal"><span class="pre">spawn_n()</span></code></a> will
block the calling greenthread until a slot becomes available.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.greenpool.GreenPool.imap">
<tt class="descname">imap</tt><big>(</big><em>function</em>, <em>*iterables</em><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPool.imap" title="Permalink to this definition"></a></dt>
<dd><p>This is the same as <a class="reference external" href="http://docs.python.org/library/itertools.html#itertools.imap" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">itertools.imap()</span></tt></a>, and has the same
concurrency and memory behavior as <a class="reference internal" href="#eventlet.greenpool.GreenPool.starmap" title="eventlet.greenpool.GreenPool.starmap"><tt class="xref py py-meth docutils literal"><span class="pre">starmap()</span></tt></a>.</p>
<code class="descname">imap</code><span class="sig-paren">(</span><em>function</em>, <em>*iterables</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPool.imap" title="Permalink to this definition"></a></dt>
<dd><p>This is the same as <a class="reference external" href="http://docs.python.org/library/itertools.html#itertools.imap" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">itertools.imap()</span></code></a>, and has the same
concurrency and memory behavior as <a class="reference internal" href="#eventlet.greenpool.GreenPool.starmap" title="eventlet.greenpool.GreenPool.starmap"><code class="xref py py-meth docutils literal"><span class="pre">starmap()</span></code></a>.</p>
<p>It&#8217;s quite convenient for, e.g., farming out jobs from a file:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">worker</span><span class="p">(</span><span class="n">line</span><span class="p">):</span>
<span class="k">return</span> <span class="n">do_something</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
@ -85,7 +85,7 @@ concurrency and memory behavior as <a class="reference internal" href="#eventlet
<dl class="method">
<dt id="eventlet.greenpool.GreenPool.resize">
<tt class="descname">resize</tt><big>(</big><em>new_size</em><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPool.resize" title="Permalink to this definition"></a></dt>
<code class="descname">resize</code><span class="sig-paren">(</span><em>new_size</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPool.resize" title="Permalink to this definition"></a></dt>
<dd><p>Change the max number of greenthreads doing work at any given time.</p>
<p>If resize is called when there are more than <em>new_size</em> greenthreads
already working on tasks, they will be allowed to complete but no new
@ -96,36 +96,36 @@ then, the return value of free() will be negative.</p>
<dl class="method">
<dt id="eventlet.greenpool.GreenPool.running">
<tt class="descname">running</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPool.running" title="Permalink to this definition"></a></dt>
<code class="descname">running</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPool.running" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of greenthreads that are currently executing
functions in the GreenPool.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.greenpool.GreenPool.spawn">
<tt class="descname">spawn</tt><big>(</big><em>function</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPool.spawn" title="Permalink to this definition"></a></dt>
<code class="descname">spawn</code><span class="sig-paren">(</span><em>function</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPool.spawn" title="Permalink to this definition"></a></dt>
<dd><p>Run the <em>function</em> with its arguments in its own green thread.
Returns the <a class="reference internal" href="greenthread.html#eventlet.greenthread.GreenThread" title="eventlet.greenthread.GreenThread"><tt class="xref py py-class docutils literal"><span class="pre">GreenThread</span></tt></a>
Returns the <a class="reference internal" href="greenthread.html#eventlet.greenthread.GreenThread" title="eventlet.greenthread.GreenThread"><code class="xref py py-class docutils literal"><span class="pre">GreenThread</span></code></a>
object that is running the function, which can be used to retrieve the
results.</p>
<p>If the pool is currently at capacity, <tt class="docutils literal"><span class="pre">spawn</span></tt> will block until one of
<p>If the pool is currently at capacity, <code class="docutils literal"><span class="pre">spawn</span></code> will block until one of
the running greenthreads completes its task and frees up a slot.</p>
<p>This function is reentrant; <em>function</em> can call <tt class="docutils literal"><span class="pre">spawn</span></tt> on the same
<p>This function is reentrant; <em>function</em> can call <code class="docutils literal"><span class="pre">spawn</span></code> on the same
pool without risk of deadlocking the whole thing.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.greenpool.GreenPool.spawn_n">
<tt class="descname">spawn_n</tt><big>(</big><em>function</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPool.spawn_n" title="Permalink to this definition"></a></dt>
<code class="descname">spawn_n</code><span class="sig-paren">(</span><em>function</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPool.spawn_n" title="Permalink to this definition"></a></dt>
<dd><p>Create a greenthread to run the <em>function</em>, the same as
<a class="reference internal" href="#eventlet.greenpool.GreenPool.spawn" title="eventlet.greenpool.GreenPool.spawn"><tt class="xref py py-meth docutils literal"><span class="pre">spawn()</span></tt></a>. The difference is that <a class="reference internal" href="#eventlet.greenpool.GreenPool.spawn_n" title="eventlet.greenpool.GreenPool.spawn_n"><tt class="xref py py-meth docutils literal"><span class="pre">spawn_n()</span></tt></a> returns
<a class="reference internal" href="#eventlet.greenpool.GreenPool.spawn" title="eventlet.greenpool.GreenPool.spawn"><code class="xref py py-meth docutils literal"><span class="pre">spawn()</span></code></a>. The difference is that <a class="reference internal" href="#eventlet.greenpool.GreenPool.spawn_n" title="eventlet.greenpool.GreenPool.spawn_n"><code class="xref py py-meth docutils literal"><span class="pre">spawn_n()</span></code></a> returns
None; the results of <em>function</em> are not retrievable.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.greenpool.GreenPool.starmap">
<tt class="descname">starmap</tt><big>(</big><em>function</em>, <em>iterable</em><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPool.starmap" title="Permalink to this definition"></a></dt>
<dd><p>This is the same as <a class="reference external" href="http://docs.python.org/library/itertools.html#itertools.starmap" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">itertools.starmap()</span></tt></a>, except that <em>func</em> is
<code class="descname">starmap</code><span class="sig-paren">(</span><em>function</em>, <em>iterable</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPool.starmap" title="Permalink to this definition"></a></dt>
<dd><p>This is the same as <a class="reference external" href="http://docs.python.org/library/itertools.html#itertools.starmap" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">itertools.starmap()</span></code></a>, except that <em>func</em> is
executed in a separate green thread for each item, with the concurrency
limited by the pool&#8217;s size. In operation, starmap consumes a constant
amount of memory, proportional to the size of the pool, and is thus
@ -134,13 +134,13 @@ suited for iterating over extremely long input lists.</p>
<dl class="method">
<dt id="eventlet.greenpool.GreenPool.waitall">
<tt class="descname">waitall</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPool.waitall" title="Permalink to this definition"></a></dt>
<code class="descname">waitall</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPool.waitall" title="Permalink to this definition"></a></dt>
<dd><p>Waits until all greenthreads in the pool are finished working.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.greenpool.GreenPool.waiting">
<tt class="descname">waiting</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPool.waiting" title="Permalink to this definition"></a></dt>
<code class="descname">waiting</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPool.waiting" title="Permalink to this definition"></a></dt>
<dd><p>Return the number of greenthreads waiting to spawn.</p>
</dd></dl>
@ -148,7 +148,7 @@ suited for iterating over extremely long input lists.</p>
<dl class="class">
<dt id="eventlet.greenpool.GreenPile">
<em class="property">class </em><tt class="descclassname">eventlet.greenpool.</tt><tt class="descname">GreenPile</tt><big>(</big><em>size_or_pool=1000</em><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPile" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.greenpool.</code><code class="descname">GreenPile</code><span class="sig-paren">(</span><em>size_or_pool=1000</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPile" title="Permalink to this definition"></a></dt>
<dd><p>GreenPile is an abstraction representing a bunch of I/O-related tasks.</p>
<p>Construct a GreenPile with an existing GreenPool object. The GreenPile will
then use that pool&#8217;s concurrency as it processes its jobs. There can be
@ -161,14 +161,14 @@ than the one which is calling spawn. The iterator will exit early in that
situation.</p>
<dl class="method">
<dt id="eventlet.greenpool.GreenPile.next">
<tt class="descname">next</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPile.next" title="Permalink to this definition"></a></dt>
<code class="descname">next</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPile.next" title="Permalink to this definition"></a></dt>
<dd><p>Wait for the next result, suspending the current greenthread until it
is available. Raises StopIteration when there are no more results.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.greenpool.GreenPile.spawn">
<tt class="descname">spawn</tt><big>(</big><em>func</em>, <em>*args</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#eventlet.greenpool.GreenPile.spawn" title="Permalink to this definition"></a></dt>
<code class="descname">spawn</code><span class="sig-paren">(</span><em>func</em>, <em>*args</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenpool.GreenPile.spawn" title="Permalink to this definition"></a></dt>
<dd><p>Runs <em>func</em> in its own green thread, with the result available by
iterating over the GreenPile object.</p>
</dd></dl>
@ -181,20 +181,22 @@ iterating over the GreenPile object.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="event.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">event</span></tt> &#8211; Cross-greenthread primitive</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">event</span></code> &#8211; Cross-greenthread primitive</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="greenthread.html"
title="next chapter"><tt class="docutils literal"><span class="pre">greenthread</span></tt> &#8211; Green Thread Implementation</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/greenpool.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">greenthread</span></code> &#8211; Green Thread Implementation</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/greenpool.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -211,7 +213,7 @@ iterating over the GreenPile object.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -226,14 +228,14 @@ iterating over the GreenPile object.</p>
<li class="right" >
<a href="event.html" title="event Cross-greenthread primitive"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>greenthread Green Thread Implementation &mdash; Eventlet 0.16.1 documentation</title>
<title>greenthread Green Thread Implementation &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="pools - Generic pools of resources" href="pools.html" />
<link rel="prev" title="greenpool Green Thread Pools" href="greenpool.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,127 +44,127 @@
<li class="right" >
<a href="greenpool.html" title="greenpool Green Thread Pools"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="module-eventlet.greenthread">
<span id="greenthread-green-thread-implementation"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">greenthread</span></tt> &#8211; Green Thread Implementation<a class="headerlink" href="#module-eventlet.greenthread" title="Permalink to this headline"></a></h1>
<span id="greenthread-green-thread-implementation"></span><h1><code class="xref py py-mod docutils literal"><span class="pre">greenthread</span></code> &#8211; Green Thread Implementation<a class="headerlink" href="#module-eventlet.greenthread" title="Permalink to this headline"></a></h1>
<dl class="function">
<dt id="eventlet.greenthread.sleep">
<tt class="descclassname">eventlet.greenthread.</tt><tt class="descname">sleep</tt><big>(</big><em>seconds=0</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.sleep" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.greenthread.</code><code class="descname">sleep</code><span class="sig-paren">(</span><em>seconds=0</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.sleep" title="Permalink to this definition"></a></dt>
<dd><p>Yield control to another eligible coroutine until at least <em>seconds</em> have
elapsed.</p>
<p><em>seconds</em> may be specified as an integer, or a float if fractional seconds
are desired. Calling <tt class="xref py py-func docutils literal"><span class="pre">sleep()</span></tt> with <em>seconds</em> of 0 is the
are desired. Calling <code class="xref py py-func docutils literal"><span class="pre">sleep()</span></code> with <em>seconds</em> of 0 is the
canonical way of expressing a cooperative yield. For example, if one is
looping over a large list performing an expensive calculation without
calling any socket methods, it&#8217;s a good idea to call <tt class="docutils literal"><span class="pre">sleep(0)</span></tt>
calling any socket methods, it&#8217;s a good idea to call <code class="docutils literal"><span class="pre">sleep(0)</span></code>
occasionally; otherwise nothing else will run.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.greenthread.spawn">
<tt class="descclassname">eventlet.greenthread.</tt><tt class="descname">spawn</tt><big>(</big><em>func</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.spawn" title="Permalink to this definition"></a></dt>
<dd><p>Create a greenthread to run <tt class="docutils literal"><span class="pre">func(*args,</span> <span class="pre">**kwargs)</span></tt>. Returns a
<a class="reference internal" href="#eventlet.greenthread.GreenThread" title="eventlet.greenthread.GreenThread"><tt class="xref py py-class docutils literal"><span class="pre">GreenThread</span></tt></a> object which you can use to get the results of the
<code class="descclassname">eventlet.greenthread.</code><code class="descname">spawn</code><span class="sig-paren">(</span><em>func</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.spawn" title="Permalink to this definition"></a></dt>
<dd><p>Create a greenthread to run <code class="docutils literal"><span class="pre">func(*args,</span> <span class="pre">**kwargs)</span></code>. Returns a
<a class="reference internal" href="#eventlet.greenthread.GreenThread" title="eventlet.greenthread.GreenThread"><code class="xref py py-class docutils literal"><span class="pre">GreenThread</span></code></a> object which you can use to get the results of the
call.</p>
<p>Execution control returns immediately to the caller; the created greenthread
is merely scheduled to be run at the next available opportunity.
Use <a class="reference internal" href="#eventlet.greenthread.spawn_after" title="eventlet.greenthread.spawn_after"><tt class="xref py py-func docutils literal"><span class="pre">spawn_after()</span></tt></a> to arrange for greenthreads to be spawned
Use <a class="reference internal" href="#eventlet.greenthread.spawn_after" title="eventlet.greenthread.spawn_after"><code class="xref py py-func docutils literal"><span class="pre">spawn_after()</span></code></a> to arrange for greenthreads to be spawned
after a finite delay.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.greenthread.spawn_n">
<tt class="descclassname">eventlet.greenthread.</tt><tt class="descname">spawn_n</tt><big>(</big><em>func</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.spawn_n" title="Permalink to this definition"></a></dt>
<dd><p>Same as <a class="reference internal" href="#eventlet.greenthread.spawn" title="eventlet.greenthread.spawn"><tt class="xref py py-func docutils literal"><span class="pre">spawn()</span></tt></a>, but returns a <tt class="docutils literal"><span class="pre">greenlet</span></tt> object from
<code class="descclassname">eventlet.greenthread.</code><code class="descname">spawn_n</code><span class="sig-paren">(</span><em>func</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.spawn_n" title="Permalink to this definition"></a></dt>
<dd><p>Same as <a class="reference internal" href="#eventlet.greenthread.spawn" title="eventlet.greenthread.spawn"><code class="xref py py-func docutils literal"><span class="pre">spawn()</span></code></a>, but returns a <code class="docutils literal"><span class="pre">greenlet</span></code> object from
which it is not possible to retrieve either a return value or
whether it raised any exceptions. This is faster than
<a class="reference internal" href="#eventlet.greenthread.spawn" title="eventlet.greenthread.spawn"><tt class="xref py py-func docutils literal"><span class="pre">spawn()</span></tt></a>; it is fastest if there are no keyword arguments.</p>
<a class="reference internal" href="#eventlet.greenthread.spawn" title="eventlet.greenthread.spawn"><code class="xref py py-func docutils literal"><span class="pre">spawn()</span></code></a>; it is fastest if there are no keyword arguments.</p>
<p>If an exception is raised in the function, spawn_n prints a stack
trace; the print can be disabled by calling
<a class="reference internal" href="debug.html#eventlet.debug.hub_exceptions" title="eventlet.debug.hub_exceptions"><tt class="xref py py-func docutils literal"><span class="pre">eventlet.debug.hub_exceptions()</span></tt></a> with False.</p>
<a class="reference internal" href="debug.html#eventlet.debug.hub_exceptions" title="eventlet.debug.hub_exceptions"><code class="xref py py-func docutils literal"><span class="pre">eventlet.debug.hub_exceptions()</span></code></a> with False.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.greenthread.kill">
<tt class="descclassname">eventlet.greenthread.</tt><tt class="descname">kill</tt><big>(</big><em>g</em>, <em>*throw_args</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.kill" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.greenthread.</code><code class="descname">kill</code><span class="sig-paren">(</span><em>g</em>, <em>*throw_args</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.kill" title="Permalink to this definition"></a></dt>
<dd><p>Terminates the target greenthread by raising an exception into it.
Whatever that greenthread might be doing; be it waiting for I/O or another
primitive, it sees an exception right away.</p>
<p>By default, this exception is GreenletExit, but a specific exception
may be specified. <em>throw_args</em> should be the same as the arguments to
raise; either an exception instance or an exc_info tuple.</p>
<p>Calling <a class="reference internal" href="#eventlet.greenthread.kill" title="eventlet.greenthread.kill"><tt class="xref py py-func docutils literal"><span class="pre">kill()</span></tt></a> causes the calling greenthread to cooperatively yield.</p>
<p>Calling <a class="reference internal" href="#eventlet.greenthread.kill" title="eventlet.greenthread.kill"><code class="xref py py-func docutils literal"><span class="pre">kill()</span></code></a> causes the calling greenthread to cooperatively yield.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.greenthread.spawn_after">
<tt class="descclassname">eventlet.greenthread.</tt><tt class="descname">spawn_after</tt><big>(</big><em>seconds</em>, <em>func</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.spawn_after" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.greenthread.</code><code class="descname">spawn_after</code><span class="sig-paren">(</span><em>seconds</em>, <em>func</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.spawn_after" title="Permalink to this definition"></a></dt>
<dd><p>Spawns <em>func</em> after <em>seconds</em> have elapsed. It runs as scheduled even if
the current greenthread has completed.</p>
<p><em>seconds</em> may be specified as an integer, or a float if fractional seconds
are desired. The <em>func</em> will be called with the given <em>args</em> and
keyword arguments <em>kwargs</em>, and will be executed within its own greenthread.</p>
<p>The return value of <a class="reference internal" href="#eventlet.greenthread.spawn_after" title="eventlet.greenthread.spawn_after"><tt class="xref py py-func docutils literal"><span class="pre">spawn_after()</span></tt></a> is a <a class="reference internal" href="#eventlet.greenthread.GreenThread" title="eventlet.greenthread.GreenThread"><tt class="xref py py-class docutils literal"><span class="pre">GreenThread</span></tt></a> object,
<p>The return value of <a class="reference internal" href="#eventlet.greenthread.spawn_after" title="eventlet.greenthread.spawn_after"><code class="xref py py-func docutils literal"><span class="pre">spawn_after()</span></code></a> is a <a class="reference internal" href="#eventlet.greenthread.GreenThread" title="eventlet.greenthread.GreenThread"><code class="xref py py-class docutils literal"><span class="pre">GreenThread</span></code></a> object,
which can be used to retrieve the results of the call.</p>
<p>To cancel the spawn and prevent <em>func</em> from being called,
call <a class="reference internal" href="#eventlet.greenthread.GreenThread.cancel" title="eventlet.greenthread.GreenThread.cancel"><tt class="xref py py-meth docutils literal"><span class="pre">GreenThread.cancel()</span></tt></a> on the return value of <a class="reference internal" href="#eventlet.greenthread.spawn_after" title="eventlet.greenthread.spawn_after"><tt class="xref py py-func docutils literal"><span class="pre">spawn_after()</span></tt></a>.
call <a class="reference internal" href="#eventlet.greenthread.GreenThread.cancel" title="eventlet.greenthread.GreenThread.cancel"><code class="xref py py-meth docutils literal"><span class="pre">GreenThread.cancel()</span></code></a> on the return value of <a class="reference internal" href="#eventlet.greenthread.spawn_after" title="eventlet.greenthread.spawn_after"><code class="xref py py-func docutils literal"><span class="pre">spawn_after()</span></code></a>.
This will not abort the function if it&#8217;s already started running, which is
generally the desired behavior. If terminating <em>func</em> regardless of whether
it&#8217;s started or not is the desired behavior, call <a class="reference internal" href="#eventlet.greenthread.GreenThread.kill" title="eventlet.greenthread.GreenThread.kill"><tt class="xref py py-meth docutils literal"><span class="pre">GreenThread.kill()</span></tt></a>.</p>
it&#8217;s started or not is the desired behavior, call <a class="reference internal" href="#eventlet.greenthread.GreenThread.kill" title="eventlet.greenthread.GreenThread.kill"><code class="xref py py-meth docutils literal"><span class="pre">GreenThread.kill()</span></code></a>.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.greenthread.spawn_after_local">
<tt class="descclassname">eventlet.greenthread.</tt><tt class="descname">spawn_after_local</tt><big>(</big><em>seconds</em>, <em>func</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.spawn_after_local" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.greenthread.</code><code class="descname">spawn_after_local</code><span class="sig-paren">(</span><em>seconds</em>, <em>func</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.spawn_after_local" title="Permalink to this definition"></a></dt>
<dd><p>Spawns <em>func</em> after <em>seconds</em> have elapsed. The function will NOT be
called if the current greenthread has exited.</p>
<p><em>seconds</em> may be specified as an integer, or a float if fractional seconds
are desired. The <em>func</em> will be called with the given <em>args</em> and
keyword arguments <em>kwargs</em>, and will be executed within its own greenthread.</p>
<p>The return value of <a class="reference internal" href="#eventlet.greenthread.spawn_after" title="eventlet.greenthread.spawn_after"><tt class="xref py py-func docutils literal"><span class="pre">spawn_after()</span></tt></a> is a <a class="reference internal" href="#eventlet.greenthread.GreenThread" title="eventlet.greenthread.GreenThread"><tt class="xref py py-class docutils literal"><span class="pre">GreenThread</span></tt></a> object,
<p>The return value of <a class="reference internal" href="#eventlet.greenthread.spawn_after" title="eventlet.greenthread.spawn_after"><code class="xref py py-func docutils literal"><span class="pre">spawn_after()</span></code></a> is a <a class="reference internal" href="#eventlet.greenthread.GreenThread" title="eventlet.greenthread.GreenThread"><code class="xref py py-class docutils literal"><span class="pre">GreenThread</span></code></a> object,
which can be used to retrieve the results of the call.</p>
<p>To cancel the spawn and prevent <em>func</em> from being called,
call <a class="reference internal" href="#eventlet.greenthread.GreenThread.cancel" title="eventlet.greenthread.GreenThread.cancel"><tt class="xref py py-meth docutils literal"><span class="pre">GreenThread.cancel()</span></tt></a> on the return value. This will not abort the
call <a class="reference internal" href="#eventlet.greenthread.GreenThread.cancel" title="eventlet.greenthread.GreenThread.cancel"><code class="xref py py-meth docutils literal"><span class="pre">GreenThread.cancel()</span></code></a> on the return value. This will not abort the
function if it&#8217;s already started running. If terminating <em>func</em> regardless
of whether it&#8217;s started or not is the desired behavior, call
<a class="reference internal" href="#eventlet.greenthread.GreenThread.kill" title="eventlet.greenthread.GreenThread.kill"><tt class="xref py py-meth docutils literal"><span class="pre">GreenThread.kill()</span></tt></a>.</p>
<a class="reference internal" href="#eventlet.greenthread.GreenThread.kill" title="eventlet.greenthread.GreenThread.kill"><code class="xref py py-meth docutils literal"><span class="pre">GreenThread.kill()</span></code></a>.</p>
</dd></dl>
<dl class="class">
<dt id="eventlet.greenthread.GreenThread">
<em class="property">class </em><tt class="descclassname">eventlet.greenthread.</tt><tt class="descname">GreenThread</tt><big>(</big><em>parent</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.GreenThread" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.greenthread.</code><code class="descname">GreenThread</code><span class="sig-paren">(</span><em>parent</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.GreenThread" title="Permalink to this definition"></a></dt>
<dd><p>The GreenThread class is a type of Greenlet which has the additional
property of being able to retrieve the return value of the main function.
Do not construct GreenThread objects directly; call <a class="reference internal" href="#eventlet.greenthread.spawn" title="eventlet.greenthread.spawn"><tt class="xref py py-func docutils literal"><span class="pre">spawn()</span></tt></a> to get one.</p>
Do not construct GreenThread objects directly; call <a class="reference internal" href="#eventlet.greenthread.spawn" title="eventlet.greenthread.spawn"><code class="xref py py-func docutils literal"><span class="pre">spawn()</span></code></a> to get one.</p>
<dl class="method">
<dt id="eventlet.greenthread.GreenThread.cancel">
<tt class="descname">cancel</tt><big>(</big><em>*throw_args</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.GreenThread.cancel" title="Permalink to this definition"></a></dt>
<dd><p>Kills the greenthread using <a class="reference internal" href="#eventlet.greenthread.kill" title="eventlet.greenthread.kill"><tt class="xref py py-func docutils literal"><span class="pre">kill()</span></tt></a>, but only if it hasn&#8217;t
<code class="descname">cancel</code><span class="sig-paren">(</span><em>*throw_args</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.GreenThread.cancel" title="Permalink to this definition"></a></dt>
<dd><p>Kills the greenthread using <a class="reference internal" href="#eventlet.greenthread.kill" title="eventlet.greenthread.kill"><code class="xref py py-func docutils literal"><span class="pre">kill()</span></code></a>, but only if it hasn&#8217;t
already started running. After being canceled,
all calls to <a class="reference internal" href="#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><tt class="xref py py-meth docutils literal"><span class="pre">wait()</span></tt></a> will raise <em>throw_args</em> (which default
to <tt class="xref py py-class docutils literal"><span class="pre">greenlet.GreenletExit</span></tt>).</p>
all calls to <a class="reference internal" href="#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a> will raise <em>throw_args</em> (which default
to <code class="xref py py-class docutils literal"><span class="pre">greenlet.GreenletExit</span></code>).</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.greenthread.GreenThread.kill">
<tt class="descname">kill</tt><big>(</big><em>*throw_args</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.GreenThread.kill" title="Permalink to this definition"></a></dt>
<dd><p>Kills the greenthread using <a class="reference internal" href="#eventlet.greenthread.kill" title="eventlet.greenthread.kill"><tt class="xref py py-func docutils literal"><span class="pre">kill()</span></tt></a>. After being killed
all calls to <a class="reference internal" href="#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><tt class="xref py py-meth docutils literal"><span class="pre">wait()</span></tt></a> will raise <em>throw_args</em> (which default
to <tt class="xref py py-class docutils literal"><span class="pre">greenlet.GreenletExit</span></tt>).</p>
<code class="descname">kill</code><span class="sig-paren">(</span><em>*throw_args</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.GreenThread.kill" title="Permalink to this definition"></a></dt>
<dd><p>Kills the greenthread using <a class="reference internal" href="#eventlet.greenthread.kill" title="eventlet.greenthread.kill"><code class="xref py py-func docutils literal"><span class="pre">kill()</span></code></a>. After being killed
all calls to <a class="reference internal" href="#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a> will raise <em>throw_args</em> (which default
to <code class="xref py py-class docutils literal"><span class="pre">greenlet.GreenletExit</span></code>).</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.greenthread.GreenThread.link">
<tt class="descname">link</tt><big>(</big><em>func</em>, <em>*curried_args</em>, <em>**curried_kwargs</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.GreenThread.link" title="Permalink to this definition"></a></dt>
<code class="descname">link</code><span class="sig-paren">(</span><em>func</em>, <em>*curried_args</em>, <em>**curried_kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.GreenThread.link" title="Permalink to this definition"></a></dt>
<dd><p>Set up a function to be called with the results of the GreenThread.</p>
<p>The function must have the following signature:</p>
<div class="highlight-python"><div class="highlight"><pre>def func(gt, [curried args/kwargs]):
@ -182,17 +182,17 @@ greenthread.</p>
<dl class="method">
<dt id="eventlet.greenthread.GreenThread.unlink">
<tt class="descname">unlink</tt><big>(</big><em>func</em>, <em>*curried_args</em>, <em>**curried_kwargs</em><big>)</big><a class="headerlink" href="#eventlet.greenthread.GreenThread.unlink" title="Permalink to this definition"></a></dt>
<dd><p>remove linked function set by <a class="reference internal" href="#eventlet.greenthread.GreenThread.link" title="eventlet.greenthread.GreenThread.link"><tt class="xref py py-meth docutils literal"><span class="pre">link()</span></tt></a></p>
<code class="descname">unlink</code><span class="sig-paren">(</span><em>func</em>, <em>*curried_args</em>, <em>**curried_kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.GreenThread.unlink" title="Permalink to this definition"></a></dt>
<dd><p>remove linked function set by <a class="reference internal" href="#eventlet.greenthread.GreenThread.link" title="eventlet.greenthread.GreenThread.link"><code class="xref py py-meth docutils literal"><span class="pre">link()</span></code></a></p>
<p>Remove successfully return True, otherwise False</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.greenthread.GreenThread.wait">
<tt class="descname">wait</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.greenthread.GreenThread.wait" title="Permalink to this definition"></a></dt>
<code class="descname">wait</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.greenthread.GreenThread.wait" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of the main function of this GreenThread. If the
result is a normal return value, <a class="reference internal" href="#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><tt class="xref py py-meth docutils literal"><span class="pre">wait()</span></tt></a> returns it. If it raised
an exception, <a class="reference internal" href="#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><tt class="xref py py-meth docutils literal"><span class="pre">wait()</span></tt></a> will raise the same exception (though the
result is a normal return value, <a class="reference internal" href="#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a> returns it. If it raised
an exception, <a class="reference internal" href="#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a> will raise the same exception (though the
stack trace will unavoidably contain some frames from within the
greenthread module).</p>
</dd></dl>
@ -205,20 +205,22 @@ greenthread module).</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="greenpool.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">greenpool</span></tt> &#8211; Green Thread Pools</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">greenpool</span></code> &#8211; Green Thread Pools</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="pools.html"
title="next chapter"><tt class="docutils literal"><span class="pre">pools</span></tt> - Generic pools of resources</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/greenthread.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">pools</span></code> - Generic pools of resources</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/greenthread.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -235,7 +237,7 @@ greenthread module).</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -250,14 +252,14 @@ greenthread module).</p>
<li class="right" >
<a href="greenpool.html" title="greenpool Green Thread Pools"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pools - Generic pools of resources &mdash; Eventlet 0.16.1 documentation</title>
<title>pools - Generic pools of resources &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="queue Queue class" href="queue.html" />
<link rel="prev" title="greenthread Green Thread Implementation" href="greenthread.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,21 +44,21 @@
<li class="right" >
<a href="greenthread.html" title="greenthread Green Thread Implementation"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="module-eventlet.pools">
<span id="pools-generic-pools-of-resources"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">pools</span></tt> - Generic pools of resources<a class="headerlink" href="#module-eventlet.pools" title="Permalink to this headline"></a></h1>
<span id="pools-generic-pools-of-resources"></span><h1><code class="xref py py-mod docutils literal"><span class="pre">pools</span></code> - Generic pools of resources<a class="headerlink" href="#module-eventlet.pools" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="eventlet.pools.Pool">
<em class="property">class </em><tt class="descclassname">eventlet.pools.</tt><tt class="descname">Pool</tt><big>(</big><em>min_size=0</em>, <em>max_size=4</em>, <em>order_as_stack=False</em>, <em>create=None</em><big>)</big><a class="headerlink" href="#eventlet.pools.Pool" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.pools.</code><code class="descname">Pool</code><span class="sig-paren">(</span><em>min_size=0</em>, <em>max_size=4</em>, <em>order_as_stack=False</em>, <em>create=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.pools.Pool" title="Permalink to this definition"></a></dt>
<dd><p>Pool class implements resource limitation and construction.</p>
<p>There are two ways of using Pool: passing a <cite>create</cite> argument or
subclassing. In either case you must provide a way to create
@ -72,66 +72,66 @@ the resource.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">http_pool</span> <span class="o">=</span> <span class="n">pools</span><span class="o">.</span><span class="n">Pool</span><span class="p">(</span><span class="n">create</span><span class="o">=</span><span class="k">lambda</span><span class="p">:</span> <span class="n">httplib2</span><span class="o">.</span><span class="n">Http</span><span class="p">(</span><span class="n">timeout</span><span class="o">=</span><span class="mi">90</span><span class="p">))</span>
</pre></div>
</div>
<p>or <a class="reference external" href="http://docs.python.org/library/functools.html#functools.partial" title="(in Python v2.7)"><tt class="xref py py-func docutils literal"><span class="pre">functools.partial()</span></tt></a>:</p>
<p>or <a class="reference external" href="http://docs.python.org/library/functools.html#functools.partial" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">functools.partial()</span></code></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="n">partial</span>
<span class="n">http_pool</span> <span class="o">=</span> <span class="n">pools</span><span class="o">.</span><span class="n">Pool</span><span class="p">(</span><span class="n">create</span><span class="o">=</span><span class="n">partial</span><span class="p">(</span><span class="n">httplib2</span><span class="o">.</span><span class="n">Http</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="mi">90</span><span class="p">))</span>
</pre></div>
</div>
<p>When subclassing, define only the <a class="reference internal" href="#eventlet.pools.Pool.create" title="eventlet.pools.Pool.create"><tt class="xref py py-meth docutils literal"><span class="pre">create()</span></tt></a> method
<p>When subclassing, define only the <a class="reference internal" href="#eventlet.pools.Pool.create" title="eventlet.pools.Pool.create"><code class="xref py py-meth docutils literal"><span class="pre">create()</span></code></a> method
to implement the desired resource:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">MyPool</span><span class="p">(</span><span class="n">pools</span><span class="o">.</span><span class="n">Pool</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">create</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="n">MyObject</span><span class="p">()</span>
</pre></div>
</div>
<p>If using 2.5 or greater, the <a class="reference internal" href="#eventlet.pools.Pool.item" title="eventlet.pools.Pool.item"><tt class="xref py py-meth docutils literal"><span class="pre">item()</span></tt></a> method acts as a context manager;
<p>If using 2.5 or greater, the <a class="reference internal" href="#eventlet.pools.Pool.item" title="eventlet.pools.Pool.item"><code class="xref py py-meth docutils literal"><span class="pre">item()</span></code></a> method acts as a context manager;
that&#8217;s the best way to use it:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">mypool</span><span class="o">.</span><span class="n">item</span><span class="p">()</span> <span class="k">as</span> <span class="n">thing</span><span class="p">:</span>
<span class="n">thing</span><span class="o">.</span><span class="n">dostuff</span><span class="p">()</span>
</pre></div>
</div>
<p>The maximum size of the pool can be modified at runtime via
the <a class="reference internal" href="#eventlet.pools.Pool.resize" title="eventlet.pools.Pool.resize"><tt class="xref py py-meth docutils literal"><span class="pre">resize()</span></tt></a> method.</p>
the <a class="reference internal" href="#eventlet.pools.Pool.resize" title="eventlet.pools.Pool.resize"><code class="xref py py-meth docutils literal"><span class="pre">resize()</span></code></a> method.</p>
<p>Specifying a non-zero <em>min-size</em> argument pre-populates the pool with
<em>min_size</em> items. <em>max-size</em> sets a hard limit to the size of the pool &#8211;
it cannot contain any more items than <em>max_size</em>, and if there are already
<em>max_size</em> items &#8216;checked out&#8217; of the pool, the pool will cause any
greenthread calling <a class="reference internal" href="#eventlet.pools.Pool.get" title="eventlet.pools.Pool.get"><tt class="xref py py-meth docutils literal"><span class="pre">get()</span></tt></a> to cooperatively yield until an item
is <a class="reference internal" href="#eventlet.pools.Pool.put" title="eventlet.pools.Pool.put"><tt class="xref py py-meth docutils literal"><span class="pre">put()</span></tt></a> in.</p>
greenthread calling <a class="reference internal" href="#eventlet.pools.Pool.get" title="eventlet.pools.Pool.get"><code class="xref py py-meth docutils literal"><span class="pre">get()</span></code></a> to cooperatively yield until an item
is <a class="reference internal" href="#eventlet.pools.Pool.put" title="eventlet.pools.Pool.put"><code class="xref py py-meth docutils literal"><span class="pre">put()</span></code></a> in.</p>
<dl class="method">
<dt id="eventlet.pools.Pool.create">
<tt class="descname">create</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.pools.Pool.create" title="Permalink to this definition"></a></dt>
<code class="descname">create</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.pools.Pool.create" title="Permalink to this definition"></a></dt>
<dd><p>Generate a new pool item. In order for the pool to
function, either this method must be overriden in a subclass
or the pool must be constructed with the <cite>create</cite> argument.
It accepts no arguments and returns a single instance of
whatever thing the pool is supposed to contain.</p>
<p>In general, <a class="reference internal" href="#eventlet.pools.Pool.create" title="eventlet.pools.Pool.create"><tt class="xref py py-meth docutils literal"><span class="pre">create()</span></tt></a> is called whenever the pool exceeds its
<p>In general, <a class="reference internal" href="#eventlet.pools.Pool.create" title="eventlet.pools.Pool.create"><code class="xref py py-meth docutils literal"><span class="pre">create()</span></code></a> is called whenever the pool exceeds its
previous high-water mark of concurrently-checked-out-items. In other
words, in a new pool with <em>min_size</em> of 0, the very first call
to <a class="reference internal" href="#eventlet.pools.Pool.get" title="eventlet.pools.Pool.get"><tt class="xref py py-meth docutils literal"><span class="pre">get()</span></tt></a> will result in a call to <a class="reference internal" href="#eventlet.pools.Pool.create" title="eventlet.pools.Pool.create"><tt class="xref py py-meth docutils literal"><span class="pre">create()</span></tt></a>. If the first
caller calls <a class="reference internal" href="#eventlet.pools.Pool.put" title="eventlet.pools.Pool.put"><tt class="xref py py-meth docutils literal"><span class="pre">put()</span></tt></a> before some other caller calls <a class="reference internal" href="#eventlet.pools.Pool.get" title="eventlet.pools.Pool.get"><tt class="xref py py-meth docutils literal"><span class="pre">get()</span></tt></a>,
then the first item will be returned, and <a class="reference internal" href="#eventlet.pools.Pool.create" title="eventlet.pools.Pool.create"><tt class="xref py py-meth docutils literal"><span class="pre">create()</span></tt></a> will not be
to <a class="reference internal" href="#eventlet.pools.Pool.get" title="eventlet.pools.Pool.get"><code class="xref py py-meth docutils literal"><span class="pre">get()</span></code></a> will result in a call to <a class="reference internal" href="#eventlet.pools.Pool.create" title="eventlet.pools.Pool.create"><code class="xref py py-meth docutils literal"><span class="pre">create()</span></code></a>. If the first
caller calls <a class="reference internal" href="#eventlet.pools.Pool.put" title="eventlet.pools.Pool.put"><code class="xref py py-meth docutils literal"><span class="pre">put()</span></code></a> before some other caller calls <a class="reference internal" href="#eventlet.pools.Pool.get" title="eventlet.pools.Pool.get"><code class="xref py py-meth docutils literal"><span class="pre">get()</span></code></a>,
then the first item will be returned, and <a class="reference internal" href="#eventlet.pools.Pool.create" title="eventlet.pools.Pool.create"><code class="xref py py-meth docutils literal"><span class="pre">create()</span></code></a> will not be
called a second time.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.pools.Pool.free">
<tt class="descname">free</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.pools.Pool.free" title="Permalink to this definition"></a></dt>
<code class="descname">free</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.pools.Pool.free" title="Permalink to this definition"></a></dt>
<dd><p>Return the number of free items in the pool. This corresponds
to the number of <a class="reference internal" href="#eventlet.pools.Pool.get" title="eventlet.pools.Pool.get"><tt class="xref py py-meth docutils literal"><span class="pre">get()</span></tt></a> calls needed to empty the pool.</p>
to the number of <a class="reference internal" href="#eventlet.pools.Pool.get" title="eventlet.pools.Pool.get"><code class="xref py py-meth docutils literal"><span class="pre">get()</span></code></a> calls needed to empty the pool.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.pools.Pool.get">
<tt class="descname">get</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.pools.Pool.get" title="Permalink to this definition"></a></dt>
<code class="descname">get</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.pools.Pool.get" title="Permalink to this definition"></a></dt>
<dd><p>Return an item from the pool, when one is available. This may
cause the calling greenthread to block.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.pools.Pool.item">
<tt class="descname">item</tt><big>(</big><em>*args</em>, <em>**kwds</em><big>)</big><a class="headerlink" href="#eventlet.pools.Pool.item" title="Permalink to this definition"></a></dt>
<code class="descname">item</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.pools.Pool.item" title="Permalink to this definition"></a></dt>
<dd><p>Get an object out of the pool, for use with with statement.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">pools</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pool</span> <span class="o">=</span> <span class="n">pools</span><span class="o">.</span><span class="n">TokenPool</span><span class="p">(</span><span class="n">max_size</span><span class="o">=</span><span class="mi">4</span><span class="p">)</span>
@ -147,25 +147,25 @@ cause the calling greenthread to block.</p>
<dl class="method">
<dt id="eventlet.pools.Pool.put">
<tt class="descname">put</tt><big>(</big><em>item</em><big>)</big><a class="headerlink" href="#eventlet.pools.Pool.put" title="Permalink to this definition"></a></dt>
<code class="descname">put</code><span class="sig-paren">(</span><em>item</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.pools.Pool.put" title="Permalink to this definition"></a></dt>
<dd><p>Put an item back into the pool, when done. This may
cause the putting greenthread to block.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.pools.Pool.resize">
<tt class="descname">resize</tt><big>(</big><em>new_size</em><big>)</big><a class="headerlink" href="#eventlet.pools.Pool.resize" title="Permalink to this definition"></a></dt>
<code class="descname">resize</code><span class="sig-paren">(</span><em>new_size</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.pools.Pool.resize" title="Permalink to this definition"></a></dt>
<dd><p>Resize the pool to <em>new_size</em>.</p>
<p>Adjusting this number does not affect existing items checked out of
the pool, nor on any greenthreads who are waiting for an item to free
up. Some indeterminate number of <a class="reference internal" href="#eventlet.pools.Pool.get" title="eventlet.pools.Pool.get"><tt class="xref py py-meth docutils literal"><span class="pre">get()</span></tt></a>/<a class="reference internal" href="#eventlet.pools.Pool.put" title="eventlet.pools.Pool.put"><tt class="xref py py-meth docutils literal"><span class="pre">put()</span></tt></a>
up. Some indeterminate number of <a class="reference internal" href="#eventlet.pools.Pool.get" title="eventlet.pools.Pool.get"><code class="xref py py-meth docutils literal"><span class="pre">get()</span></code></a>/<a class="reference internal" href="#eventlet.pools.Pool.put" title="eventlet.pools.Pool.put"><code class="xref py py-meth docutils literal"><span class="pre">put()</span></code></a>
cycles will be necessary before the new maximum size truly matches
the actual operation of the pool.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.pools.Pool.waiting">
<tt class="descname">waiting</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.pools.Pool.waiting" title="Permalink to this definition"></a></dt>
<code class="descname">waiting</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.pools.Pool.waiting" title="Permalink to this definition"></a></dt>
<dd><p>Return the number of routines waiting for a pool item.</p>
</dd></dl>
@ -173,7 +173,7 @@ the actual operation of the pool.</p>
<dl class="class">
<dt id="eventlet.pools.TokenPool">
<em class="property">class </em><tt class="descclassname">eventlet.pools.</tt><tt class="descname">TokenPool</tt><big>(</big><em>min_size=0</em>, <em>max_size=4</em>, <em>order_as_stack=False</em>, <em>create=None</em><big>)</big><a class="headerlink" href="#eventlet.pools.TokenPool" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.pools.</code><code class="descname">TokenPool</code><span class="sig-paren">(</span><em>min_size=0</em>, <em>max_size=4</em>, <em>order_as_stack=False</em>, <em>create=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.pools.TokenPool" title="Permalink to this definition"></a></dt>
<dd><p>A pool which gives out tokens (opaque unique objects), which indicate
that the coroutine which holds the token has a right to consume some
limited resource.</p>
@ -185,20 +185,22 @@ limited resource.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="greenthread.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">greenthread</span></tt> &#8211; Green Thread Implementation</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">greenthread</span></code> &#8211; Green Thread Implementation</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="queue.html"
title="next chapter"><tt class="docutils literal"><span class="pre">queue</span></tt> &#8211; Queue class</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/pools.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">queue</span></code> &#8211; Queue class</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/pools.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -215,7 +217,7 @@ limited resource.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -230,14 +232,14 @@ limited resource.</p>
<li class="right" >
<a href="greenthread.html" title="greenthread Green Thread Implementation"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>queue Queue class &mdash; Eventlet 0.16.1 documentation</title>
<title>queue Queue class &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="semaphore Semaphore classes" href="semaphore.html" />
<link rel="prev" title="pools - Generic pools of resources" href="pools.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,164 +44,164 @@
<li class="right" >
<a href="pools.html" title="pools - Generic pools of resources"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="module-eventlet.queue">
<span id="queue-queue-class"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">queue</span></tt> &#8211; Queue class<a class="headerlink" href="#module-eventlet.queue" title="Permalink to this headline"></a></h1>
<span id="queue-queue-class"></span><h1><code class="xref py py-mod docutils literal"><span class="pre">queue</span></code> &#8211; Queue class<a class="headerlink" href="#module-eventlet.queue" title="Permalink to this headline"></a></h1>
<p>Synchronized queues.</p>
<p>The <a class="reference internal" href="#module-eventlet.queue" title="eventlet.queue"><tt class="xref py py-mod docutils literal"><span class="pre">eventlet.queue</span></tt></a> module implements multi-producer, multi-consumer
<p>The <a class="reference internal" href="#module-eventlet.queue" title="eventlet.queue"><code class="xref py py-mod docutils literal"><span class="pre">eventlet.queue</span></code></a> module implements multi-producer, multi-consumer
queues that work across greenlets, with the API similar to the classes found in
the standard <a class="reference external" href="http://docs.python.org/library/queue.html#module-Queue" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">Queue</span></tt></a> and <a class="reference external" href="http://docs.python.org/library/multiprocessing.html#multiprocessing.Queue" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">multiprocessing</span></tt></a>
the standard <a class="reference external" href="http://docs.python.org/library/queue.html#module-Queue" title="(in Python v2.7)"><code class="xref py py-mod docutils literal"><span class="pre">Queue</span></code></a> and <a class="reference external" href="http://docs.python.org/library/multiprocessing.html#multiprocessing.Queue" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">multiprocessing</span></code></a>
modules.</p>
<p>A major difference is that queues in this module operate as channels when
initialized with <em>maxsize</em> of zero. In such case, both <tt class="xref py py-meth docutils literal"><span class="pre">Queue.empty()</span></tt>
and <tt class="xref py py-meth docutils literal"><span class="pre">Queue.full()</span></tt> return <tt class="docutils literal"><span class="pre">True</span></tt> and <tt class="xref py py-meth docutils literal"><span class="pre">Queue.put()</span></tt> always blocks until
a call to <tt class="xref py py-meth docutils literal"><span class="pre">Queue.get()</span></tt> retrieves the item.</p>
initialized with <em>maxsize</em> of zero. In such case, both <code class="xref py py-meth docutils literal"><span class="pre">Queue.empty()</span></code>
and <code class="xref py py-meth docutils literal"><span class="pre">Queue.full()</span></code> return <code class="docutils literal"><span class="pre">True</span></code> and <code class="xref py py-meth docutils literal"><span class="pre">Queue.put()</span></code> always blocks until
a call to <code class="xref py py-meth docutils literal"><span class="pre">Queue.get()</span></code> retrieves the item.</p>
<p>An interesting difference, made possible because of greenthreads, is
that <tt class="xref py py-meth docutils literal"><span class="pre">Queue.qsize()</span></tt>, <tt class="xref py py-meth docutils literal"><span class="pre">Queue.empty()</span></tt>, and <tt class="xref py py-meth docutils literal"><span class="pre">Queue.full()</span></tt> <em>can</em> be
used as indicators of whether the subsequent <tt class="xref py py-meth docutils literal"><span class="pre">Queue.get()</span></tt>
or <tt class="xref py py-meth docutils literal"><span class="pre">Queue.put()</span></tt> will not block. The new methods <tt class="xref py py-meth docutils literal"><span class="pre">Queue.getting()</span></tt>
and <tt class="xref py py-meth docutils literal"><span class="pre">Queue.putting()</span></tt> report on the number of greenthreads blocking
in <tt class="xref py py-meth docutils literal"><span class="pre">put</span></tt> or <tt class="xref py py-meth docutils literal"><span class="pre">get</span></tt> respectively.</p>
that <code class="xref py py-meth docutils literal"><span class="pre">Queue.qsize()</span></code>, <code class="xref py py-meth docutils literal"><span class="pre">Queue.empty()</span></code>, and <code class="xref py py-meth docutils literal"><span class="pre">Queue.full()</span></code> <em>can</em> be
used as indicators of whether the subsequent <code class="xref py py-meth docutils literal"><span class="pre">Queue.get()</span></code>
or <code class="xref py py-meth docutils literal"><span class="pre">Queue.put()</span></code> will not block. The new methods <code class="xref py py-meth docutils literal"><span class="pre">Queue.getting()</span></code>
and <code class="xref py py-meth docutils literal"><span class="pre">Queue.putting()</span></code> report on the number of greenthreads blocking
in <code class="xref py py-meth docutils literal"><span class="pre">put</span></code> or <code class="xref py py-meth docutils literal"><span class="pre">get</span></code> respectively.</p>
<dl class="class">
<dt id="eventlet.queue.Queue">
<em class="property">class </em><tt class="descclassname">eventlet.queue.</tt><tt class="descname">Queue</tt><big>(</big><em>maxsize=None</em><big>)</big><a class="headerlink" href="#eventlet.queue.Queue" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.queue.</code><code class="descname">Queue</code><span class="sig-paren">(</span><em>maxsize=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.Queue" title="Permalink to this definition"></a></dt>
<dd><p>Create a queue object with a given maximum size.</p>
<p>If <em>maxsize</em> is less than zero or <tt class="docutils literal"><span class="pre">None</span></tt>, the queue size is infinite.</p>
<p><tt class="docutils literal"><span class="pre">Queue(0)</span></tt> is a channel, that is, its <tt class="xref py py-meth docutils literal"><span class="pre">put()</span></tt> method always blocks
until the item is delivered. (This is unlike the standard <a class="reference internal" href="#eventlet.queue.Queue" title="eventlet.queue.Queue"><tt class="xref py py-class docutils literal"><span class="pre">Queue</span></tt></a>,
<p>If <em>maxsize</em> is less than zero or <code class="docutils literal"><span class="pre">None</span></code>, the queue size is infinite.</p>
<p><code class="docutils literal"><span class="pre">Queue(0)</span></code> is a channel, that is, its <code class="xref py py-meth docutils literal"><span class="pre">put()</span></code> method always blocks
until the item is delivered. (This is unlike the standard <a class="reference internal" href="#eventlet.queue.Queue" title="eventlet.queue.Queue"><code class="xref py py-class docutils literal"><span class="pre">Queue</span></code></a>,
where 0 means infinite size).</p>
<p>In all other respects, this Queue class resembled the standard library,
<a class="reference internal" href="#eventlet.queue.Queue" title="eventlet.queue.Queue"><tt class="xref py py-class docutils literal"><span class="pre">Queue</span></tt></a>.</p>
<a class="reference internal" href="#eventlet.queue.Queue" title="eventlet.queue.Queue"><code class="xref py py-class docutils literal"><span class="pre">Queue</span></code></a>.</p>
<dl class="method">
<dt id="eventlet.queue.Queue.join">
<tt class="descname">join</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.queue.Queue.join" title="Permalink to this definition"></a></dt>
<code class="descname">join</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.Queue.join" title="Permalink to this definition"></a></dt>
<dd><p>Block until all items in the queue have been gotten and processed.</p>
<p>The count of unfinished tasks goes up whenever an item is added to the queue.
The count goes down whenever a consumer thread calls <a class="reference internal" href="#eventlet.queue.Queue.task_done" title="eventlet.queue.Queue.task_done"><tt class="xref py py-meth docutils literal"><span class="pre">task_done()</span></tt></a> to indicate
The count goes down whenever a consumer thread calls <a class="reference internal" href="#eventlet.queue.Queue.task_done" title="eventlet.queue.Queue.task_done"><code class="xref py py-meth docutils literal"><span class="pre">task_done()</span></code></a> to indicate
that the item was retrieved and all work on it is complete. When the count of
unfinished tasks drops to zero, <a class="reference internal" href="#eventlet.queue.Queue.join" title="eventlet.queue.Queue.join"><tt class="xref py py-meth docutils literal"><span class="pre">join()</span></tt></a> unblocks.</p>
unfinished tasks drops to zero, <a class="reference internal" href="#eventlet.queue.Queue.join" title="eventlet.queue.Queue.join"><code class="xref py py-meth docutils literal"><span class="pre">join()</span></code></a> unblocks.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.queue.Queue.task_done">
<tt class="descname">task_done</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.queue.Queue.task_done" title="Permalink to this definition"></a></dt>
<code class="descname">task_done</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.Queue.task_done" title="Permalink to this definition"></a></dt>
<dd><p>Indicate that a formerly enqueued task is complete. Used by queue consumer threads.
For each <tt class="xref py py-meth docutils literal"><span class="pre">get</span></tt> used to fetch a task, a subsequent call to
<a class="reference internal" href="#eventlet.queue.Queue.task_done" title="eventlet.queue.Queue.task_done"><tt class="xref py py-meth docutils literal"><span class="pre">task_done()</span></tt></a> tells the queue that the processing on the task is complete.</p>
<p>If a <a class="reference internal" href="#eventlet.queue.Queue.join" title="eventlet.queue.Queue.join"><tt class="xref py py-meth docutils literal"><span class="pre">join()</span></tt></a> is currently blocking, it will resume when all items have been processed
(meaning that a <a class="reference internal" href="#eventlet.queue.Queue.task_done" title="eventlet.queue.Queue.task_done"><tt class="xref py py-meth docutils literal"><span class="pre">task_done()</span></tt></a> call was received for every item that had been
<tt class="xref py py-meth docutils literal"><span class="pre">put</span></tt> into the queue).</p>
<p>Raises a <tt class="xref py py-exc docutils literal"><span class="pre">ValueError</span></tt> if called more times than there were items placed in the queue.</p>
For each <code class="xref py py-meth docutils literal"><span class="pre">get</span></code> used to fetch a task, a subsequent call to
<a class="reference internal" href="#eventlet.queue.Queue.task_done" title="eventlet.queue.Queue.task_done"><code class="xref py py-meth docutils literal"><span class="pre">task_done()</span></code></a> tells the queue that the processing on the task is complete.</p>
<p>If a <a class="reference internal" href="#eventlet.queue.Queue.join" title="eventlet.queue.Queue.join"><code class="xref py py-meth docutils literal"><span class="pre">join()</span></code></a> is currently blocking, it will resume when all items have been processed
(meaning that a <a class="reference internal" href="#eventlet.queue.Queue.task_done" title="eventlet.queue.Queue.task_done"><code class="xref py py-meth docutils literal"><span class="pre">task_done()</span></code></a> call was received for every item that had been
<code class="xref py py-meth docutils literal"><span class="pre">put</span></code> into the queue).</p>
<p>Raises a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> if called more times than there were items placed in the queue.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="eventlet.queue.PriorityQueue">
<em class="property">class </em><tt class="descclassname">eventlet.queue.</tt><tt class="descname">PriorityQueue</tt><big>(</big><em>maxsize=None</em><big>)</big><a class="headerlink" href="#eventlet.queue.PriorityQueue" title="Permalink to this definition"></a></dt>
<dd><p>A subclass of <a class="reference internal" href="#eventlet.queue.Queue" title="eventlet.queue.Queue"><tt class="xref py py-class docutils literal"><span class="pre">Queue</span></tt></a> that retrieves entries in priority order (lowest first).</p>
<p>Entries are typically tuples of the form: <tt class="docutils literal"><span class="pre">(priority</span> <span class="pre">number,</span> <span class="pre">data)</span></tt>.</p>
<em class="property">class </em><code class="descclassname">eventlet.queue.</code><code class="descname">PriorityQueue</code><span class="sig-paren">(</span><em>maxsize=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.PriorityQueue" title="Permalink to this definition"></a></dt>
<dd><p>A subclass of <a class="reference internal" href="#eventlet.queue.Queue" title="eventlet.queue.Queue"><code class="xref py py-class docutils literal"><span class="pre">Queue</span></code></a> that retrieves entries in priority order (lowest first).</p>
<p>Entries are typically tuples of the form: <code class="docutils literal"><span class="pre">(priority</span> <span class="pre">number,</span> <span class="pre">data)</span></code>.</p>
</dd></dl>
<dl class="class">
<dt id="eventlet.queue.LifoQueue">
<em class="property">class </em><tt class="descclassname">eventlet.queue.</tt><tt class="descname">LifoQueue</tt><big>(</big><em>maxsize=None</em><big>)</big><a class="headerlink" href="#eventlet.queue.LifoQueue" title="Permalink to this definition"></a></dt>
<dd><p>A subclass of <a class="reference internal" href="#eventlet.queue.Queue" title="eventlet.queue.Queue"><tt class="xref py py-class docutils literal"><span class="pre">Queue</span></tt></a> that retrieves most recently added entries first.</p>
<em class="property">class </em><code class="descclassname">eventlet.queue.</code><code class="descname">LifoQueue</code><span class="sig-paren">(</span><em>maxsize=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LifoQueue" title="Permalink to this definition"></a></dt>
<dd><p>A subclass of <a class="reference internal" href="#eventlet.queue.Queue" title="eventlet.queue.Queue"><code class="xref py py-class docutils literal"><span class="pre">Queue</span></code></a> that retrieves most recently added entries first.</p>
</dd></dl>
<dl class="class">
<dt id="eventlet.queue.LightQueue">
<em class="property">class </em><tt class="descclassname">eventlet.queue.</tt><tt class="descname">LightQueue</tt><big>(</big><em>maxsize=None</em><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.queue.</code><code class="descname">LightQueue</code><span class="sig-paren">(</span><em>maxsize=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue" title="Permalink to this definition"></a></dt>
<dd><p>This is a variant of Queue that behaves mostly like the standard
<a class="reference internal" href="#eventlet.queue.Queue" title="eventlet.queue.Queue"><tt class="xref py py-class docutils literal"><span class="pre">Queue</span></tt></a>. It differs by not supporting the
<a class="reference internal" href="#eventlet.queue.Queue.task_done" title="eventlet.queue.Queue.task_done"><tt class="xref py py-meth docutils literal"><span class="pre">task_done</span></tt></a> or <a class="reference internal" href="#eventlet.queue.Queue.join" title="eventlet.queue.Queue.join"><tt class="xref py py-meth docutils literal"><span class="pre">join</span></tt></a> methods,
<a class="reference internal" href="#eventlet.queue.Queue" title="eventlet.queue.Queue"><code class="xref py py-class docutils literal"><span class="pre">Queue</span></code></a>. It differs by not supporting the
<a class="reference internal" href="#eventlet.queue.Queue.task_done" title="eventlet.queue.Queue.task_done"><code class="xref py py-meth docutils literal"><span class="pre">task_done</span></code></a> or <a class="reference internal" href="#eventlet.queue.Queue.join" title="eventlet.queue.Queue.join"><code class="xref py py-meth docutils literal"><span class="pre">join</span></code></a> methods,
and is a little faster for not having that overhead.</p>
<dl class="method">
<dt id="eventlet.queue.LightQueue.empty">
<tt class="descname">empty</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue.empty" title="Permalink to this definition"></a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if the queue is empty, <tt class="docutils literal"><span class="pre">False</span></tt> otherwise.</p>
<code class="descname">empty</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue.empty" title="Permalink to this definition"></a></dt>
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> if the queue is empty, <code class="docutils literal"><span class="pre">False</span></code> otherwise.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.queue.LightQueue.full">
<tt class="descname">full</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue.full" title="Permalink to this definition"></a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if the queue is full, <tt class="docutils literal"><span class="pre">False</span></tt> otherwise.</p>
<p><tt class="docutils literal"><span class="pre">Queue(None)</span></tt> is never full.</p>
<code class="descname">full</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue.full" title="Permalink to this definition"></a></dt>
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> if the queue is full, <code class="docutils literal"><span class="pre">False</span></code> otherwise.</p>
<p><code class="docutils literal"><span class="pre">Queue(None)</span></code> is never full.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.queue.LightQueue.get">
<tt class="descname">get</tt><big>(</big><em>block=True</em>, <em>timeout=None</em><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue.get" title="Permalink to this definition"></a></dt>
<code class="descname">get</code><span class="sig-paren">(</span><em>block=True</em>, <em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue.get" title="Permalink to this definition"></a></dt>
<dd><p>Remove and return an item from the queue.</p>
<p>If optional args <em>block</em> is true and <em>timeout</em> is <tt class="docutils literal"><span class="pre">None</span></tt> (the default),
<p>If optional args <em>block</em> is true and <em>timeout</em> is <code class="docutils literal"><span class="pre">None</span></code> (the default),
block if necessary until an item is available. If <em>timeout</em> is a positive number,
it blocks at most <em>timeout</em> seconds and raises the <a class="reference internal" href="#eventlet.queue.Empty" title="eventlet.queue.Empty"><tt class="xref py py-class docutils literal"><span class="pre">Empty</span></tt></a> exception
it blocks at most <em>timeout</em> seconds and raises the <a class="reference internal" href="#eventlet.queue.Empty" title="eventlet.queue.Empty"><code class="xref py py-class docutils literal"><span class="pre">Empty</span></code></a> exception
if no item was available within that time. Otherwise (<em>block</em> is false), return
an item if one is immediately available, else raise the <a class="reference internal" href="#eventlet.queue.Empty" title="eventlet.queue.Empty"><tt class="xref py py-class docutils literal"><span class="pre">Empty</span></tt></a> exception
an item if one is immediately available, else raise the <a class="reference internal" href="#eventlet.queue.Empty" title="eventlet.queue.Empty"><code class="xref py py-class docutils literal"><span class="pre">Empty</span></code></a> exception
(<em>timeout</em> is ignored in that case).</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.queue.LightQueue.get_nowait">
<tt class="descname">get_nowait</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue.get_nowait" title="Permalink to this definition"></a></dt>
<code class="descname">get_nowait</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue.get_nowait" title="Permalink to this definition"></a></dt>
<dd><p>Remove and return an item from the queue without blocking.</p>
<p>Only get an item if one is immediately available. Otherwise
raise the <a class="reference internal" href="#eventlet.queue.Empty" title="eventlet.queue.Empty"><tt class="xref py py-class docutils literal"><span class="pre">Empty</span></tt></a> exception.</p>
raise the <a class="reference internal" href="#eventlet.queue.Empty" title="eventlet.queue.Empty"><code class="xref py py-class docutils literal"><span class="pre">Empty</span></code></a> exception.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.queue.LightQueue.getting">
<tt class="descname">getting</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue.getting" title="Permalink to this definition"></a></dt>
<code class="descname">getting</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue.getting" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of greenthreads that are blocked waiting on an
empty queue.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.queue.LightQueue.put">
<tt class="descname">put</tt><big>(</big><em>item</em>, <em>block=True</em>, <em>timeout=None</em><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue.put" title="Permalink to this definition"></a></dt>
<code class="descname">put</code><span class="sig-paren">(</span><em>item</em>, <em>block=True</em>, <em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue.put" title="Permalink to this definition"></a></dt>
<dd><p>Put an item into the queue.</p>
<p>If optional arg <em>block</em> is true and <em>timeout</em> is <tt class="docutils literal"><span class="pre">None</span></tt> (the default),
<p>If optional arg <em>block</em> is true and <em>timeout</em> is <code class="docutils literal"><span class="pre">None</span></code> (the default),
block if necessary until a free slot is available. If <em>timeout</em> is
a positive number, it blocks at most <em>timeout</em> seconds and raises
the <a class="reference internal" href="#eventlet.queue.Full" title="eventlet.queue.Full"><tt class="xref py py-class docutils literal"><span class="pre">Full</span></tt></a> exception if no free slot was available within that time.
the <a class="reference internal" href="#eventlet.queue.Full" title="eventlet.queue.Full"><code class="xref py py-class docutils literal"><span class="pre">Full</span></code></a> exception if no free slot was available within that time.
Otherwise (<em>block</em> is false), put an item on the queue if a free slot
is immediately available, else raise the <a class="reference internal" href="#eventlet.queue.Full" title="eventlet.queue.Full"><tt class="xref py py-class docutils literal"><span class="pre">Full</span></tt></a> exception (<em>timeout</em>
is immediately available, else raise the <a class="reference internal" href="#eventlet.queue.Full" title="eventlet.queue.Full"><code class="xref py py-class docutils literal"><span class="pre">Full</span></code></a> exception (<em>timeout</em>
is ignored in that case).</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.queue.LightQueue.put_nowait">
<tt class="descname">put_nowait</tt><big>(</big><em>item</em><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue.put_nowait" title="Permalink to this definition"></a></dt>
<code class="descname">put_nowait</code><span class="sig-paren">(</span><em>item</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue.put_nowait" title="Permalink to this definition"></a></dt>
<dd><p>Put an item into the queue without blocking.</p>
<p>Only enqueue the item if a free slot is immediately available.
Otherwise raise the <a class="reference internal" href="#eventlet.queue.Full" title="eventlet.queue.Full"><tt class="xref py py-class docutils literal"><span class="pre">Full</span></tt></a> exception.</p>
Otherwise raise the <a class="reference internal" href="#eventlet.queue.Full" title="eventlet.queue.Full"><code class="xref py py-class docutils literal"><span class="pre">Full</span></code></a> exception.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.queue.LightQueue.putting">
<tt class="descname">putting</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue.putting" title="Permalink to this definition"></a></dt>
<code class="descname">putting</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue.putting" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of greenthreads that are blocked waiting to put
items into the queue.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.queue.LightQueue.qsize">
<tt class="descname">qsize</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue.qsize" title="Permalink to this definition"></a></dt>
<code class="descname">qsize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue.qsize" title="Permalink to this definition"></a></dt>
<dd><p>Return the size of the queue.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.queue.LightQueue.resize">
<tt class="descname">resize</tt><big>(</big><em>size</em><big>)</big><a class="headerlink" href="#eventlet.queue.LightQueue.resize" title="Permalink to this definition"></a></dt>
<code class="descname">resize</code><span class="sig-paren">(</span><em>size</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.queue.LightQueue.resize" title="Permalink to this definition"></a></dt>
<dd><p>Resizes the queue&#8217;s maximum size.</p>
<p>If the size is increased, and there are putters waiting, they may be woken up.</p>
</dd></dl>
@ -210,13 +210,13 @@ items into the queue.</p>
<dl class="exception">
<dt id="eventlet.queue.Full">
<em class="property">exception </em><tt class="descclassname">eventlet.queue.</tt><tt class="descname">Full</tt><a class="headerlink" href="#eventlet.queue.Full" title="Permalink to this definition"></a></dt>
<em class="property">exception </em><code class="descclassname">eventlet.queue.</code><code class="descname">Full</code><a class="headerlink" href="#eventlet.queue.Full" title="Permalink to this definition"></a></dt>
<dd><p>Exception raised by Queue.put(block=0)/put_nowait().</p>
</dd></dl>
<dl class="exception">
<dt id="eventlet.queue.Empty">
<em class="property">exception </em><tt class="descclassname">eventlet.queue.</tt><tt class="descname">Empty</tt><a class="headerlink" href="#eventlet.queue.Empty" title="Permalink to this definition"></a></dt>
<em class="property">exception </em><code class="descclassname">eventlet.queue.</code><code class="descname">Empty</code><a class="headerlink" href="#eventlet.queue.Empty" title="Permalink to this definition"></a></dt>
<dd><p>Exception raised by Queue.get(block=0)/get_nowait().</p>
</dd></dl>
@ -226,20 +226,22 @@ items into the queue.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="pools.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">pools</span></tt> - Generic pools of resources</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">pools</span></code> - Generic pools of resources</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="semaphore.html"
title="next chapter"><tt class="docutils literal"><span class="pre">semaphore</span></tt> &#8211; Semaphore classes</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/queue.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">semaphore</span></code> &#8211; Semaphore classes</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/queue.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -256,7 +258,7 @@ items into the queue.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -271,14 +273,14 @@ items into the queue.</p>
<li class="right" >
<a href="pools.html" title="pools - Generic pools of resources"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>semaphore Semaphore classes &mdash; Eventlet 0.16.1 documentation</title>
<title>semaphore Semaphore classes &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="timeout Universal Timeouts" href="timeout.html" />
<link rel="prev" title="queue Queue class" href="queue.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,27 +44,27 @@
<li class="right" >
<a href="queue.html" title="queue Queue class"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="semaphore-semaphore-classes">
<h1><tt class="xref py py-mod docutils literal"><span class="pre">semaphore</span></tt> &#8211; Semaphore classes<a class="headerlink" href="#semaphore-semaphore-classes" title="Permalink to this headline"></a></h1>
<h1><code class="xref py py-mod docutils literal"><span class="pre">semaphore</span></code> &#8211; Semaphore classes<a class="headerlink" href="#semaphore-semaphore-classes" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="eventlet.semaphore.Semaphore">
<em class="property">class </em><tt class="descclassname">eventlet.semaphore.</tt><tt class="descname">Semaphore</tt><big>(</big><em>value=1</em><big>)</big><a class="headerlink" href="#eventlet.semaphore.Semaphore" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.semaphore.</code><code class="descname">Semaphore</code><span class="sig-paren">(</span><em>value=1</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.Semaphore" title="Permalink to this definition"></a></dt>
<dd><p>An unbounded semaphore.
Optionally initialize with a resource <em>count</em>, then <tt class="xref py py-meth docutils literal"><span class="pre">acquire()</span></tt> and
<tt class="xref py py-meth docutils literal"><span class="pre">release()</span></tt> resources as needed. Attempting to <tt class="xref py py-meth docutils literal"><span class="pre">acquire()</span></tt> when
Optionally initialize with a resource <em>count</em>, then <code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code> and
<code class="xref py py-meth docutils literal"><span class="pre">release()</span></code> resources as needed. Attempting to <code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code> when
<em>count</em> is zero suspends the calling greenthread until <em>count</em> becomes
nonzero again.</p>
<p>This is API-compatible with <a class="reference external" href="http://docs.python.org/library/threading.html#threading.Semaphore" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">threading.Semaphore</span></tt></a>.</p>
<p>This is API-compatible with <a class="reference external" href="http://docs.python.org/library/threading.html#threading.Semaphore" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">threading.Semaphore</span></code></a>.</p>
<p>It is a context manager, and thus can be used in a with block:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">sem</span> <span class="o">=</span> <span class="n">Semaphore</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="k">with</span> <span class="n">sem</span><span class="p">:</span>
@ -80,7 +80,7 @@ nonzero again.</p>
</div>
<dl class="method">
<dt id="eventlet.semaphore.Semaphore.acquire">
<tt class="descname">acquire</tt><big>(</big><em>blocking=True</em>, <em>timeout=None</em><big>)</big><a class="headerlink" href="#eventlet.semaphore.Semaphore.acquire" title="Permalink to this definition"></a></dt>
<code class="descname">acquire</code><span class="sig-paren">(</span><em>blocking=True</em>, <em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.Semaphore.acquire" title="Permalink to this definition"></a></dt>
<dd><p>Acquire a semaphore.</p>
<p>When invoked without arguments: if the internal counter is larger than
zero on entry, decrement it by one and return immediately. If it is zero
@ -99,33 +99,33 @@ same thing as when called without arguments, and return true.</p>
<dl class="attribute">
<dt id="eventlet.semaphore.Semaphore.balance">
<tt class="descname">balance</tt><a class="headerlink" href="#eventlet.semaphore.Semaphore.balance" title="Permalink to this definition"></a></dt>
<code class="descname">balance</code><a class="headerlink" href="#eventlet.semaphore.Semaphore.balance" title="Permalink to this definition"></a></dt>
<dd><p>An integer value that represents how many new calls to
<tt class="xref py py-meth docutils literal"><span class="pre">acquire()</span></tt> or <tt class="xref py py-meth docutils literal"><span class="pre">release()</span></tt> would be needed to get the counter to
<code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code> or <code class="xref py py-meth docutils literal"><span class="pre">release()</span></code> would be needed to get the counter to
0. If it is positive, then its value is the number of acquires that can
happen before the next acquire would block. If it is negative, it is
the negative of the number of releases that would be required in order
to make the counter 0 again (one more release would push the counter to
1 and unblock acquirers). It takes into account how many greenthreads
are currently blocking in <tt class="xref py py-meth docutils literal"><span class="pre">acquire()</span></tt>.</p>
are currently blocking in <code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.semaphore.Semaphore.bounded">
<tt class="descname">bounded</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.semaphore.Semaphore.bounded" title="Permalink to this definition"></a></dt>
<code class="descname">bounded</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.Semaphore.bounded" title="Permalink to this definition"></a></dt>
<dd><p>Returns False; for consistency with
<a class="reference internal" href="#eventlet.semaphore.CappedSemaphore" title="eventlet.semaphore.CappedSemaphore"><tt class="xref py py-class docutils literal"><span class="pre">CappedSemaphore</span></tt></a>.</p>
<a class="reference internal" href="#eventlet.semaphore.CappedSemaphore" title="eventlet.semaphore.CappedSemaphore"><code class="xref py py-class docutils literal"><span class="pre">CappedSemaphore</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.semaphore.Semaphore.locked">
<tt class="descname">locked</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.semaphore.Semaphore.locked" title="Permalink to this definition"></a></dt>
<code class="descname">locked</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.Semaphore.locked" title="Permalink to this definition"></a></dt>
<dd><p>Returns true if a call to acquire would block.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.semaphore.Semaphore.release">
<tt class="descname">release</tt><big>(</big><em>blocking=True</em><big>)</big><a class="headerlink" href="#eventlet.semaphore.Semaphore.release" title="Permalink to this definition"></a></dt>
<code class="descname">release</code><span class="sig-paren">(</span><em>blocking=True</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.Semaphore.release" title="Permalink to this definition"></a></dt>
<dd><p>Release a semaphore, incrementing the internal counter by one. When
it was zero on entry and another thread is waiting for it to become
larger than zero again, wake up that thread.</p>
@ -137,7 +137,7 @@ ignored</p>
<dl class="class">
<dt id="eventlet.semaphore.BoundedSemaphore">
<em class="property">class </em><tt class="descclassname">eventlet.semaphore.</tt><tt class="descname">BoundedSemaphore</tt><big>(</big><em>value=1</em><big>)</big><a class="headerlink" href="#eventlet.semaphore.BoundedSemaphore" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.semaphore.</code><code class="descname">BoundedSemaphore</code><span class="sig-paren">(</span><em>value=1</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.BoundedSemaphore" title="Permalink to this definition"></a></dt>
<dd><p>A bounded semaphore checks to make sure its current value doesn&#8217;t exceed
its initial value. If it does, ValueError is raised. In most situations
semaphores are used to guard resources with limited capacity. If the
@ -145,12 +145,12 @@ semaphore is released too many times it&#8217;s a sign of a bug. If not given,
<em>value</em> defaults to 1.</p>
<dl class="method">
<dt id="eventlet.semaphore.BoundedSemaphore.release">
<tt class="descname">release</tt><big>(</big><em>blocking=True</em><big>)</big><a class="headerlink" href="#eventlet.semaphore.BoundedSemaphore.release" title="Permalink to this definition"></a></dt>
<code class="descname">release</code><span class="sig-paren">(</span><em>blocking=True</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.BoundedSemaphore.release" title="Permalink to this definition"></a></dt>
<dd><p>Release a semaphore, incrementing the internal counter by one. If
the counter would exceed the initial value, raises ValueError. When
it was zero on entry and another thread is waiting for it to become
larger than zero again, wake up that thread.</p>
<p>The <em>blocking</em> argument is for consistency with <tt class="xref py py-class docutils literal"><span class="pre">CappedSemaphore</span></tt>
<p>The <em>blocking</em> argument is for consistency with <code class="xref py py-class docutils literal"><span class="pre">CappedSemaphore</span></code>
and is ignored</p>
</dd></dl>
@ -158,18 +158,18 @@ and is ignored</p>
<dl class="class">
<dt id="eventlet.semaphore.CappedSemaphore">
<em class="property">class </em><tt class="descclassname">eventlet.semaphore.</tt><tt class="descname">CappedSemaphore</tt><big>(</big><em>count</em>, <em>limit</em><big>)</big><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.semaphore.</code><code class="descname">CappedSemaphore</code><span class="sig-paren">(</span><em>count</em>, <em>limit</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore" title="Permalink to this definition"></a></dt>
<dd><p>A blockingly bounded semaphore.</p>
<p>Optionally initialize with a resource <em>count</em>, then <tt class="xref py py-meth docutils literal"><span class="pre">acquire()</span></tt> and
<tt class="xref py py-meth docutils literal"><span class="pre">release()</span></tt> resources as needed. Attempting to <tt class="xref py py-meth docutils literal"><span class="pre">acquire()</span></tt> when
<p>Optionally initialize with a resource <em>count</em>, then <code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code> and
<code class="xref py py-meth docutils literal"><span class="pre">release()</span></code> resources as needed. Attempting to <code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code> when
<em>count</em> is zero suspends the calling greenthread until count becomes nonzero
again. Attempting to <tt class="xref py py-meth docutils literal"><span class="pre">release()</span></tt> after <em>count</em> has reached <em>limit</em>
again. Attempting to <code class="xref py py-meth docutils literal"><span class="pre">release()</span></code> after <em>count</em> has reached <em>limit</em>
suspends the calling greenthread until <em>count</em> becomes less than <em>limit</em>
again.</p>
<p>This has the same API as <a class="reference external" href="http://docs.python.org/library/threading.html#threading.Semaphore" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">threading.Semaphore</span></tt></a>, though its
<p>This has the same API as <a class="reference external" href="http://docs.python.org/library/threading.html#threading.Semaphore" title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span class="pre">threading.Semaphore</span></code></a>, though its
semantics and behavior differ subtly due to the upper limit on calls
to <tt class="xref py py-meth docutils literal"><span class="pre">release()</span></tt>. It is <strong>not</strong> compatible with
<tt class="xref py py-class docutils literal"><span class="pre">threading.BoundedSemaphore</span></tt> because it blocks when reaching <em>limit</em>
to <code class="xref py py-meth docutils literal"><span class="pre">release()</span></code>. It is <strong>not</strong> compatible with
<code class="xref py py-class docutils literal"><span class="pre">threading.BoundedSemaphore</span></code> because it blocks when reaching <em>limit</em>
instead of raising a ValueError.</p>
<p>It is a context manager, and thus can be used in a with block:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">sem</span> <span class="o">=</span> <span class="n">CappedSemaphore</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
@ -179,7 +179,7 @@ instead of raising a ValueError.</p>
</div>
<dl class="method">
<dt id="eventlet.semaphore.CappedSemaphore.acquire">
<tt class="descname">acquire</tt><big>(</big><em>blocking=True</em><big>)</big><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore.acquire" title="Permalink to this definition"></a></dt>
<code class="descname">acquire</code><span class="sig-paren">(</span><em>blocking=True</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore.acquire" title="Permalink to this definition"></a></dt>
<dd><p>Acquire a semaphore.</p>
<p>When invoked without arguments: if the internal counter is larger than
zero on entry, decrement it by one and return immediately. If it is zero
@ -198,35 +198,35 @@ same thing as when called without arguments, and return true.</p>
<dl class="attribute">
<dt id="eventlet.semaphore.CappedSemaphore.balance">
<tt class="descname">balance</tt><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore.balance" title="Permalink to this definition"></a></dt>
<code class="descname">balance</code><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore.balance" title="Permalink to this definition"></a></dt>
<dd><p>An integer value that represents how many new calls to
<tt class="xref py py-meth docutils literal"><span class="pre">acquire()</span></tt> or <tt class="xref py py-meth docutils literal"><span class="pre">release()</span></tt> would be needed to get the counter to
<code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code> or <code class="xref py py-meth docutils literal"><span class="pre">release()</span></code> would be needed to get the counter to
0. If it is positive, then its value is the number of acquires that can
happen before the next acquire would block. If it is negative, it is
the negative of the number of releases that would be required in order
to make the counter 0 again (one more release would push the counter to
1 and unblock acquirers). It takes into account how many greenthreads
are currently blocking in <tt class="xref py py-meth docutils literal"><span class="pre">acquire()</span></tt> and <tt class="xref py py-meth docutils literal"><span class="pre">release()</span></tt>.</p>
are currently blocking in <code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code> and <code class="xref py py-meth docutils literal"><span class="pre">release()</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.semaphore.CappedSemaphore.bounded">
<tt class="descname">bounded</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore.bounded" title="Permalink to this definition"></a></dt>
<code class="descname">bounded</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore.bounded" title="Permalink to this definition"></a></dt>
<dd><p>Returns true if a call to release would block.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.semaphore.CappedSemaphore.locked">
<tt class="descname">locked</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore.locked" title="Permalink to this definition"></a></dt>
<code class="descname">locked</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore.locked" title="Permalink to this definition"></a></dt>
<dd><p>Returns true if a call to acquire would block.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.semaphore.CappedSemaphore.release">
<tt class="descname">release</tt><big>(</big><em>blocking=True</em><big>)</big><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore.release" title="Permalink to this definition"></a></dt>
<code class="descname">release</code><span class="sig-paren">(</span><em>blocking=True</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.semaphore.CappedSemaphore.release" title="Permalink to this definition"></a></dt>
<dd><p>Release a semaphore. In this class, this behaves very much like
an <tt class="xref py py-meth docutils literal"><span class="pre">acquire()</span></tt> but in the opposite direction.</p>
<p>Imagine the docs of <tt class="xref py py-meth docutils literal"><span class="pre">acquire()</span></tt> here, but with every direction
an <code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code> but in the opposite direction.</p>
<p>Imagine the docs of <code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code> here, but with every direction
reversed. When calling this method, it will block if the internal
counter is greater than or equal to <em>limit</em>.</p>
</dd></dl>
@ -239,20 +239,22 @@ counter is greater than or equal to <em>limit</em>.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="queue.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">queue</span></tt> &#8211; Queue class</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">queue</span></code> &#8211; Queue class</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="timeout.html"
title="next chapter"><tt class="docutils literal"><span class="pre">timeout</span></tt> &#8211; Universal Timeouts</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/semaphore.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">timeout</span></code> &#8211; Universal Timeouts</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/semaphore.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -269,7 +271,7 @@ counter is greater than or equal to <em>limit</em>.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -284,14 +286,14 @@ counter is greater than or equal to <em>limit</em>.</p>
<li class="right" >
<a href="queue.html" title="queue Queue class"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>timeout Universal Timeouts &mdash; Eventlet 0.16.1 documentation</title>
<title>timeout Universal Timeouts &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="websocket Websocket Server" href="websocket.html" />
<link rel="prev" title="semaphore Semaphore classes" href="semaphore.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,21 +44,21 @@
<li class="right" >
<a href="semaphore.html" title="semaphore Semaphore classes"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="timeout-universal-timeouts">
<h1><tt class="xref py py-mod docutils literal"><span class="pre">timeout</span></tt> &#8211; Universal Timeouts<a class="headerlink" href="#timeout-universal-timeouts" title="Permalink to this headline"></a></h1>
<h1><code class="xref py py-mod docutils literal"><span class="pre">timeout</span></code> &#8211; Universal Timeouts<a class="headerlink" href="#timeout-universal-timeouts" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="eventlet.timeout.Timeout">
<em class="property">class </em><tt class="descclassname">eventlet.timeout.</tt><tt class="descname">Timeout</tt><a class="headerlink" href="#eventlet.timeout.Timeout" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.timeout.</code><code class="descname">Timeout</code><a class="headerlink" href="#eventlet.timeout.Timeout" title="Permalink to this definition"></a></dt>
<dd><p>Raises <em>exception</em> in the current greenthread after <em>timeout</em> seconds:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">timeout</span> <span class="o">=</span> <span class="n">Timeout</span><span class="p">(</span><span class="n">seconds</span><span class="p">,</span> <span class="n">exception</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
@ -67,7 +67,7 @@
<span class="n">timeout</span><span class="o">.</span><span class="n">cancel</span><span class="p">()</span>
</pre></div>
</div>
<p>When <em>exception</em> is omitted or <tt class="docutils literal"><span class="pre">None</span></tt>, the <tt class="xref py py-class docutils literal"><span class="pre">Timeout</span></tt> instance
<p>When <em>exception</em> is omitted or <code class="docutils literal"><span class="pre">None</span></code>, the <code class="xref py py-class docutils literal"><span class="pre">Timeout</span></code> instance
itself is raised:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">eventlet</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.2</span><span class="p">)</span>
@ -76,14 +76,14 @@ itself is raised:</p>
<span class="gr">Timeout</span>: <span class="n">0.1 seconds</span>
</pre></div>
</div>
<p>You can use the <tt class="docutils literal"><span class="pre">with</span></tt> statement for additional convenience:</p>
<p>You can use the <code class="docutils literal"><span class="pre">with</span></code> statement for additional convenience:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">Timeout</span><span class="p">(</span><span class="n">seconds</span><span class="p">,</span> <span class="n">exception</span><span class="p">)</span> <span class="k">as</span> <span class="n">timeout</span><span class="p">:</span>
<span class="k">pass</span> <span class="c"># ... code block ...</span>
</pre></div>
</div>
<p>This is equivalent to the try/finally block in the first example.</p>
<p>There is an additional feature when using the <tt class="docutils literal"><span class="pre">with</span></tt> statement: if
<em>exception</em> is <tt class="docutils literal"><span class="pre">False</span></tt>, the timeout is still raised, but the with
<p>There is an additional feature when using the <code class="docutils literal"><span class="pre">with</span></code> statement: if
<em>exception</em> is <code class="docutils literal"><span class="pre">False</span></code>, the timeout is still raised, but the with
statement suppresses it, so the code outside the with-block won&#8217;t see it:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
<span class="k">with</span> <span class="n">Timeout</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="bp">False</span><span class="p">):</span>
@ -99,7 +99,7 @@ and is only useful if you&#8217;re planning to raise it directly.</p>
<p>There are two Timeout caveats to be aware of:</p>
<ul class="simple">
<li>If the code block in the try/finally or with-block never cooperatively yields, the timeout cannot be raised. In Eventlet, this should rarely be a problem, but be aware that you cannot time out CPU-only operations with this class.</li>
<li>If the code block catches and doesn&#8217;t re-raise <tt class="xref py py-class docutils literal"><span class="pre">BaseException</span></tt> (for example, with <tt class="docutils literal"><span class="pre">except:</span></tt>), then it will catch the Timeout exception, and might not abort as intended.</li>
<li>If the code block catches and doesn&#8217;t re-raise <code class="xref py py-class docutils literal"><span class="pre">BaseException</span></code> (for example, with <code class="docutils literal"><span class="pre">except:</span></code>), then it will catch the Timeout exception, and might not abort as intended.</li>
</ul>
<p>When catching timeouts, keep in mind that the one you catch may not be the
one you have set; if you going to silence a timeout, always check that it&#8217;s
@ -114,17 +114,17 @@ the same instance that you set:</p>
</div>
<dl class="method">
<dt id="eventlet.timeout.eventlet.timeout.Timeout.Timeout.cancel">
<tt class="descclassname">Timeout.</tt><tt class="descname">cancel</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.timeout.eventlet.timeout.Timeout.Timeout.cancel" title="Permalink to this definition"></a></dt>
<code class="descclassname">Timeout.</code><code class="descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.timeout.eventlet.timeout.Timeout.Timeout.cancel" title="Permalink to this definition"></a></dt>
<dd><p>If the timeout is pending, cancel it. If not using
Timeouts in <tt class="docutils literal"><span class="pre">with</span></tt> statements, always call cancel() in a
<tt class="docutils literal"><span class="pre">finally</span></tt> after the block of code that is getting timed out.
Timeouts in <code class="docutils literal"><span class="pre">with</span></code> statements, always call cancel() in a
<code class="docutils literal"><span class="pre">finally</span></code> after the block of code that is getting timed out.
If not canceled, the timeout will be raised later on, in some
unexpected section of the application.</p>
</dd></dl>
<dl class="attribute">
<dt id="eventlet.timeout.eventlet.timeout.Timeout.Timeout.pending">
<tt class="descclassname">Timeout.</tt><tt class="descname">pending</tt><a class="headerlink" href="#eventlet.timeout.eventlet.timeout.Timeout.Timeout.pending" title="Permalink to this definition"></a></dt>
<code class="descclassname">Timeout.</code><code class="descname">pending</code><a class="headerlink" href="#eventlet.timeout.eventlet.timeout.Timeout.Timeout.pending" title="Permalink to this definition"></a></dt>
<dd><p>True if the timeout is scheduled to be raised.</p>
</dd></dl>
@ -132,7 +132,7 @@ unexpected section of the application.</p>
<dl class="function">
<dt id="eventlet.timeout.with_timeout">
<tt class="descclassname">eventlet.timeout.</tt><tt class="descname">with_timeout</tt><big>(</big><em>seconds</em>, <em>function</em>, <em>*args</em>, <em>**kwds</em><big>)</big><a class="headerlink" href="#eventlet.timeout.with_timeout" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.timeout.</code><code class="descname">with_timeout</code><span class="sig-paren">(</span><em>seconds</em>, <em>function</em>, <em>*args</em>, <em>**kwds</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.timeout.with_timeout" title="Permalink to this definition"></a></dt>
<dd><p>Wrap a call to some (yielding) function with a timeout; if the called
function fails to return before the timeout, cancel it and return a flag
value.</p>
@ -146,15 +146,15 @@ value.</p>
<li><strong>*args</strong> &#8211; positional arguments to pass to <em>func</em></li>
<li><strong>**kwds</strong> &#8211; keyword arguments to pass to <em>func</em></li>
<li><strong>timeout_value</strong> &#8211; value to return if timeout occurs (by default raises
<tt class="xref py py-class docutils literal"><span class="pre">Timeout</span></tt>)</li>
<code class="xref py py-class docutils literal"><span class="pre">Timeout</span></code>)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">Value returned by <em>func</em> if <em>func</em> returns before <em>seconds</em>, else
<em>timeout_value</em> if provided, else raises <tt class="xref py py-class docutils literal"><span class="pre">Timeout</span></tt>.</p>
<em>timeout_value</em> if provided, else raises <code class="xref py py-class docutils literal"><span class="pre">Timeout</span></code>.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises Timeout:</th><td class="field-body"><p class="first">if <em>func</em> times out and no <tt class="docutils literal"><span class="pre">timeout_value</span></tt> has
<tr class="field-odd field"><th class="field-name">Raises Timeout:</th><td class="field-body"><p class="first">if <em>func</em> times out and no <code class="docutils literal"><span class="pre">timeout_value</span></code> has
been provided.</p>
</td>
</tr>
@ -167,8 +167,8 @@ been provided.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">data</span> <span class="o">=</span> <span class="n">with_timeout</span><span class="p">(</span><span class="mi">30</span><span class="p">,</span> <span class="n">urllib2</span><span class="o">.</span><span class="n">open</span><span class="p">,</span> <span class="s">&#39;http://www.google.com/&#39;</span><span class="p">,</span> <span class="n">timeout_value</span><span class="o">=</span><span class="s">&quot;&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>Here <em>data</em> is either the result of the <tt class="docutils literal"><span class="pre">get()</span></tt> call, or the empty string
if it took too long to return. Any exception raised by the <tt class="docutils literal"><span class="pre">get()</span></tt> call
<p>Here <em>data</em> is either the result of the <code class="docutils literal"><span class="pre">get()</span></code> call, or the empty string
if it took too long to return. Any exception raised by the <code class="docutils literal"><span class="pre">get()</span></code> call
is passed through to the caller.</p>
</dd></dl>
@ -178,20 +178,22 @@ is passed through to the caller.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="semaphore.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">semaphore</span></tt> &#8211; Semaphore classes</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">semaphore</span></code> &#8211; Semaphore classes</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="websocket.html"
title="next chapter"><tt class="docutils literal"><span class="pre">websocket</span></tt> &#8211; Websocket Server</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/timeout.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">websocket</span></code> &#8211; Websocket Server</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/timeout.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -208,7 +210,7 @@ is passed through to the caller.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -223,14 +225,14 @@ is passed through to the caller.</p>
<li class="right" >
<a href="semaphore.html" title="semaphore Semaphore classes"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>websocket Websocket Server &mdash; Eventlet 0.16.1 documentation</title>
<title>websocket Websocket Server &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="wsgi WSGI server" href="wsgi.html" />
<link rel="prev" title="timeout Universal Timeouts" href="timeout.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,23 +44,23 @@
<li class="right" >
<a href="timeout.html" title="timeout Universal Timeouts"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="websocket-websocket-server">
<h1><tt class="xref py py-mod docutils literal"><span class="pre">websocket</span></tt> &#8211; Websocket Server<a class="headerlink" href="#websocket-websocket-server" title="Permalink to this headline"></a></h1>
<h1><code class="xref py py-mod docutils literal"><span class="pre">websocket</span></code> &#8211; Websocket Server<a class="headerlink" href="#websocket-websocket-server" title="Permalink to this headline"></a></h1>
<p>This module provides a simple way to create a <a class="reference external" href="http://dev.w3.org/html5/websockets/">websocket</a> server. It works with a few
tweaks in the <a class="reference internal" href="wsgi.html#module-eventlet.wsgi" title="eventlet.wsgi"><tt class="xref py py-mod docutils literal"><span class="pre">wsgi</span></tt></a> module that allow websockets to
tweaks in the <a class="reference internal" href="wsgi.html#module-eventlet.wsgi" title="eventlet.wsgi"><code class="xref py py-mod docutils literal"><span class="pre">wsgi</span></code></a> module that allow websockets to
coexist with other WSGI applications.</p>
<p>To create a websocket server, simply decorate a handler method with
<tt class="xref py py-class docutils literal"><span class="pre">WebSocketWSGI</span></tt> and use it as a wsgi application:</p>
<code class="xref py py-class docutils literal"><span class="pre">WebSocketWSGI</span></code> and use it as a wsgi application:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">wsgi</span><span class="p">,</span> <span class="n">websocket</span>
<span class="kn">import</span> <span class="nn">eventlet</span>
@ -73,19 +73,19 @@ coexist with other WSGI applications.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Please see graceful termination warning in <a class="reference internal" href="wsgi.html#eventlet.wsgi.server" title="eventlet.wsgi.server"><tt class="xref py py-func docutils literal"><span class="pre">server()</span></tt></a>
<p class="last">Please see graceful termination warning in <a class="reference internal" href="wsgi.html#eventlet.wsgi.server" title="eventlet.wsgi.server"><code class="xref py py-func docutils literal"><span class="pre">server()</span></code></a>
documentation</p>
</div>
<p>You can find a slightly more elaborate version of this code in the file
<tt class="docutils literal"><span class="pre">examples/websocket.py</span></tt>.</p>
<p>As of version 0.9.13, eventlet.websocket supports SSL websockets; all that&#8217;s necessary is to use an <a class="reference internal" href="wsgi.html#wsgi-ssl"><em>SSL wsgi server</em></a>.</p>
<code class="docutils literal"><span class="pre">examples/websocket.py</span></code>.</p>
<p>As of version 0.9.13, eventlet.websocket supports SSL websockets; all that&#8217;s necessary is to use an <a class="reference internal" href="wsgi.html#wsgi-ssl"><span>SSL wsgi server</span></a>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The web socket spec is still under development, and it will be necessary to change the way that this module works in response to spec changes.</p>
</div>
<span class="target" id="module-eventlet.websocket"></span><dl class="class">
<dt id="eventlet.websocket.WebSocketWSGI">
<em class="property">class </em><tt class="descclassname">eventlet.websocket.</tt><tt class="descname">WebSocketWSGI</tt><big>(</big><em>handler</em><big>)</big><a class="headerlink" href="#eventlet.websocket.WebSocketWSGI" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.websocket.</code><code class="descname">WebSocketWSGI</code><span class="sig-paren">(</span><em>handler</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.websocket.WebSocketWSGI" title="Permalink to this definition"></a></dt>
<dd><p>Wraps a websocket handler function in a WSGI application.</p>
<p>Use it like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@websocket.WebSocketWSGI</span>
@ -95,18 +95,18 @@ documentation</p>
</pre></div>
</div>
<p>The single argument to the function will be an instance of
<a class="reference internal" href="#eventlet.websocket.WebSocket" title="eventlet.websocket.WebSocket"><tt class="xref py py-class docutils literal"><span class="pre">WebSocket</span></tt></a>. To close the socket, simply return from the
<a class="reference internal" href="#eventlet.websocket.WebSocket" title="eventlet.websocket.WebSocket"><code class="xref py py-class docutils literal"><span class="pre">WebSocket</span></code></a>. To close the socket, simply return from the
function. Note that the server will log the websocket request at
the time of closure.</p>
</dd></dl>
<dl class="class">
<dt id="eventlet.websocket.WebSocket">
<em class="property">class </em><tt class="descclassname">eventlet.websocket.</tt><tt class="descname">WebSocket</tt><big>(</big><em>sock</em>, <em>environ</em>, <em>version=76</em><big>)</big><a class="headerlink" href="#eventlet.websocket.WebSocket" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.websocket.</code><code class="descname">WebSocket</code><span class="sig-paren">(</span><em>sock</em>, <em>environ</em>, <em>version=76</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.websocket.WebSocket" title="Permalink to this definition"></a></dt>
<dd><p>A websocket object that handles the details of
serialization/deserialization to the socket.</p>
<p>The primary way to interact with a <a class="reference internal" href="#eventlet.websocket.WebSocket" title="eventlet.websocket.WebSocket"><tt class="xref py py-class docutils literal"><span class="pre">WebSocket</span></tt></a> object is to
call <a class="reference internal" href="#eventlet.websocket.WebSocket.send" title="eventlet.websocket.WebSocket.send"><tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt></a> and <a class="reference internal" href="#eventlet.websocket.WebSocket.wait" title="eventlet.websocket.WebSocket.wait"><tt class="xref py py-meth docutils literal"><span class="pre">wait()</span></tt></a> in order to pass messages back
<p>The primary way to interact with a <a class="reference internal" href="#eventlet.websocket.WebSocket" title="eventlet.websocket.WebSocket"><code class="xref py py-class docutils literal"><span class="pre">WebSocket</span></code></a> object is to
call <a class="reference internal" href="#eventlet.websocket.WebSocket.send" title="eventlet.websocket.WebSocket.send"><code class="xref py py-meth docutils literal"><span class="pre">send()</span></code></a> and <a class="reference internal" href="#eventlet.websocket.WebSocket.wait" title="eventlet.websocket.WebSocket.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a> in order to pass messages back
and forth with the browser. Also available are the following
properties:</p>
<dl class="docutils">
@ -122,14 +122,14 @@ but more convenient.</dd>
</dl>
<dl class="method">
<dt id="eventlet.websocket.WebSocket.close">
<tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.websocket.WebSocket.close" title="Permalink to this definition"></a></dt>
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.websocket.WebSocket.close" title="Permalink to this definition"></a></dt>
<dd><p>Forcibly close the websocket; generally it is preferable to
return from the handler method.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.websocket.WebSocket.send">
<tt class="descname">send</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#eventlet.websocket.WebSocket.send" title="Permalink to this definition"></a></dt>
<code class="descname">send</code><span class="sig-paren">(</span><em>message</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.websocket.WebSocket.send" title="Permalink to this definition"></a></dt>
<dd><p>Send a message to the browser.</p>
<p><em>message</em> should be convertable to a string; unicode objects should be
encodable as utf-8. Raises socket.error with errno of 32
@ -138,7 +138,7 @@ encodable as utf-8. Raises socket.error with errno of 32
<dl class="method">
<dt id="eventlet.websocket.WebSocket.wait">
<tt class="descname">wait</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.websocket.WebSocket.wait" title="Permalink to this definition"></a></dt>
<code class="descname">wait</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.websocket.WebSocket.wait" title="Permalink to this definition"></a></dt>
<dd><p>Waits for and deserializes messages.</p>
<p>Returns a single message; the oldest not yet processed. If the client
has already closed the connection, returns None. This is different
@ -154,20 +154,22 @@ websocket message.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="timeout.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">timeout</span></tt> &#8211; Universal Timeouts</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">timeout</span></code> &#8211; Universal Timeouts</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="wsgi.html"
title="next chapter"><tt class="docutils literal"><span class="pre">wsgi</span></tt> &#8211; WSGI server</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/websocket.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">wsgi</span></code> &#8211; WSGI server</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/websocket.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -184,7 +186,7 @@ websocket message.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -199,14 +201,14 @@ websocket message.</p>
<li class="right" >
<a href="timeout.html" title="timeout Universal Timeouts"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>wsgi WSGI server &mdash; Eventlet 0.16.1 documentation</title>
<title>wsgi WSGI server &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="eventlet.green.zmq ØMQ support" href="zmq.html" />
<link rel="prev" title="websocket Websocket Server" href="websocket.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,23 +44,23 @@
<li class="right" >
<a href="websocket.html" title="websocket Websocket Server"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="wsgi-wsgi-server">
<h1><tt class="xref py py-mod docutils literal"><span class="pre">wsgi</span></tt> &#8211; WSGI server<a class="headerlink" href="#wsgi-wsgi-server" title="Permalink to this headline"></a></h1>
<h1><code class="xref py py-mod docutils literal"><span class="pre">wsgi</span></code> &#8211; WSGI server<a class="headerlink" href="#wsgi-wsgi-server" title="Permalink to this headline"></a></h1>
<p>The wsgi module provides a simple and easy way to start an event-driven
<a class="reference external" href="http://wsgi.org/wsgi/">WSGI</a> server. This can serve as an embedded
web server in an application, or as the basis for a more full-featured web
server package. One such package is <a class="reference external" href="http://pypi.python.org/pypi/Spawning/">Spawning</a>.</p>
<p>To launch a wsgi server, simply create a socket and call <a class="reference internal" href="#eventlet.wsgi.server" title="eventlet.wsgi.server"><tt class="xref py py-func docutils literal"><span class="pre">eventlet.wsgi.server()</span></tt></a> with it:</p>
<p>To launch a wsgi server, simply create a socket and call <a class="reference internal" href="#eventlet.wsgi.server" title="eventlet.wsgi.server"><code class="xref py py-func docutils literal"><span class="pre">eventlet.wsgi.server()</span></code></a> with it:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">wsgi</span>
<span class="kn">import</span> <span class="nn">eventlet</span>
@ -72,24 +72,24 @@ server package. One such package is <a class="reference external" href="http://
</pre></div>
</div>
<p>You can find a slightly more elaborate version of this code in the file
<tt class="docutils literal"><span class="pre">examples/wsgi.py</span></tt>.</p>
<code class="docutils literal"><span class="pre">examples/wsgi.py</span></code>.</p>
<span class="target" id="module-eventlet.wsgi"></span><dl class="function">
<dt id="eventlet.wsgi.server">
<tt class="descclassname">eventlet.wsgi.</tt><tt class="descname">server</tt><big>(</big><em>sock</em>, <em>site</em>, <em>log=None</em>, <em>environ=None</em>, <em>max_size=None</em>, <em>max_http_version='HTTP/1.1'</em>, <em>protocol=&lt;class eventlet.wsgi.HttpProtocol at 0x7f8e1d89b2c0&gt;</em>, <em>server_event=None</em>, <em>minimum_chunk_size=None</em>, <em>log_x_forwarded_for=True</em>, <em>custom_pool=None</em>, <em>keepalive=True</em>, <em>log_output=True</em>, <em>log_format='%(client_ip)s - - [%(date_time)s] &quot;%(request_line)s&quot; %(status_code)s %(body_length)s %(wall_seconds).6f'</em>, <em>url_length_limit=8192</em>, <em>debug=True</em>, <em>socket_timeout=None</em>, <em>capitalize_response_headers=True</em><big>)</big><a class="headerlink" href="#eventlet.wsgi.server" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.wsgi.</code><code class="descname">server</code><span class="sig-paren">(</span><em>sock</em>, <em>site</em>, <em>log=None</em>, <em>environ=None</em>, <em>max_size=None</em>, <em>max_http_version='HTTP/1.1'</em>, <em>protocol=&lt;class 'eventlet.wsgi.HttpProtocol'&gt;</em>, <em>server_event=None</em>, <em>minimum_chunk_size=None</em>, <em>log_x_forwarded_for=True</em>, <em>custom_pool=None</em>, <em>keepalive=True</em>, <em>log_output=True</em>, <em>log_format='%(client_ip)s - - [%(date_time)s] &quot;%(request_line)s&quot; %(status_code)s %(body_length)s %(wall_seconds).6f'</em>, <em>url_length_limit=8192</em>, <em>debug=True</em>, <em>socket_timeout=None</em>, <em>capitalize_response_headers=True</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.wsgi.server" title="Permalink to this definition"></a></dt>
<dd><p>Start up a WSGI server handling requests from the supplied server
socket. This function loops forever. The <em>sock</em> object will be
closed after server exits, but the underlying file descriptor will
remain open, so if you have a dup() of <em>sock</em>, it will remain usable.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p>At the moment <a class="reference internal" href="#eventlet.wsgi.server" title="eventlet.wsgi.server"><tt class="xref py py-func docutils literal"><span class="pre">server()</span></tt></a> will always wait for active connections to finish before
<p>At the moment <a class="reference internal" href="#eventlet.wsgi.server" title="eventlet.wsgi.server"><code class="xref py py-func docutils literal"><span class="pre">server()</span></code></a> will always wait for active connections to finish before
exiting, even if there&#8217;s an exception raised inside it
(<em>all</em> exceptions are handled the same way, including <tt class="xref py py-class docutils literal"><span class="pre">greenlet.GreenletExit</span></tt>
(<em>all</em> exceptions are handled the same way, including <code class="xref py py-class docutils literal"><span class="pre">greenlet.GreenletExit</span></code>
and those inheriting from <cite>BaseException</cite>).</p>
<p class="last">While this may not be an issue normally, when it comes to long running HTTP connections
(like <a class="reference internal" href="websocket.html#module-eventlet.websocket" title="eventlet.websocket"><tt class="xref py py-mod docutils literal"><span class="pre">eventlet.websocket</span></tt></a>) it will become problematic and calling
<a class="reference internal" href="greenthread.html#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><tt class="xref py py-meth docutils literal"><span class="pre">wait()</span></tt></a> on a thread that runs the server may hang,
even after using <a class="reference internal" href="greenthread.html#eventlet.greenthread.GreenThread.kill" title="eventlet.greenthread.GreenThread.kill"><tt class="xref py py-meth docutils literal"><span class="pre">kill()</span></tt></a>, as long
(like <a class="reference internal" href="websocket.html#module-eventlet.websocket" title="eventlet.websocket"><code class="xref py py-mod docutils literal"><span class="pre">eventlet.websocket</span></code></a>) it will become problematic and calling
<a class="reference internal" href="greenthread.html#eventlet.greenthread.GreenThread.wait" title="eventlet.greenthread.GreenThread.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a> on a thread that runs the server may hang,
even after using <a class="reference internal" href="greenthread.html#eventlet.greenthread.GreenThread.kill" title="eventlet.greenthread.GreenThread.kill"><code class="xref py py-meth docutils literal"><span class="pre">kill()</span></code></a>, as long
as there are active connections.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
@ -140,13 +140,13 @@ Default is True.</li>
<dl class="function">
<dt id="eventlet.wsgi.format_date_time">
<tt class="descclassname">eventlet.wsgi.</tt><tt class="descname">format_date_time</tt><big>(</big><em>timestamp</em><big>)</big><a class="headerlink" href="#eventlet.wsgi.format_date_time" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.wsgi.</code><code class="descname">format_date_time</code><span class="sig-paren">(</span><em>timestamp</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.wsgi.format_date_time" title="Permalink to this definition"></a></dt>
<dd><p>Formats a unix timestamp into an HTTP standard string.</p>
</dd></dl>
<div class="section" id="ssl">
<span id="wsgi-ssl"></span><h2>SSL<a class="headerlink" href="#ssl" title="Permalink to this headline"></a></h2>
<p>Creating a secure server is only slightly more involved than the base example. All that&#8217;s needed is to pass an SSL-wrapped socket to the <a class="reference internal" href="#eventlet.wsgi.server" title="eventlet.wsgi.server"><tt class="xref py py-func docutils literal"><span class="pre">server()</span></tt></a> method:</p>
<p>Creating a secure server is only slightly more involved than the base example. All that&#8217;s needed is to pass an SSL-wrapped socket to the <a class="reference internal" href="#eventlet.wsgi.server" title="eventlet.wsgi.server"><code class="xref py py-func docutils literal"><span class="pre">server()</span></code></a> method:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">wsgi</span><span class="o">.</span><span class="n">server</span><span class="p">(</span><span class="n">eventlet</span><span class="o">.</span><span class="n">wrap_ssl</span><span class="p">(</span><span class="n">eventlet</span><span class="o">.</span><span class="n">listen</span><span class="p">((</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="mi">8090</span><span class="p">)),</span>
<span class="n">certfile</span><span class="o">=</span><span class="s">&#39;cert.crt&#39;</span><span class="p">,</span>
<span class="n">keyfile</span><span class="o">=</span><span class="s">&#39;private.key&#39;</span><span class="p">,</span>
@ -154,14 +154,14 @@ Default is True.</li>
<span class="n">hello_world</span><span class="p">)</span>
</pre></div>
</div>
<p>Applications can detect whether they are inside a secure server by the value of the <tt class="docutils literal"><span class="pre">env['wsgi.url_scheme']</span></tt> environment variable.</p>
<p>Applications can detect whether they are inside a secure server by the value of the <code class="docutils literal"><span class="pre">env['wsgi.url_scheme']</span></code> environment variable.</p>
</div>
<div class="section" id="non-standard-extension-to-support-post-hooks">
<h2>Non-Standard Extension to Support Post Hooks<a class="headerlink" href="#non-standard-extension-to-support-post-hooks" title="Permalink to this headline"></a></h2>
<p>Eventlet&#8217;s WSGI server supports a non-standard extension to the WSGI
specification where <tt class="samp docutils literal"><span class="pre">env['eventlet.posthooks']</span></tt> contains an array of
specification where <code class="samp docutils literal"><span class="pre">env['eventlet.posthooks']</span></code> contains an array of
<cite>post hooks</cite> that will be called after fully sending a response. Each post hook
is a tuple of <tt class="samp docutils literal"><span class="pre">(func,</span> <span class="pre">args,</span> <span class="pre">kwargs)</span></tt> and the <cite>func</cite> will be called with
is a tuple of <code class="samp docutils literal"><span class="pre">(func,</span> <span class="pre">args,</span> <span class="pre">kwargs)</span></code> and the <cite>func</cite> will be called with
the WSGI environment dictionary, followed by the <cite>args</cite> and then the <cite>kwargs</cite>
in the post hook.</p>
<p>For example:</p>
@ -201,7 +201,7 @@ unencrypted decision before starting to send the data).</p>
<p>This works well for WSGI servers as the WSGI specification mandates HTTP
expect/continue mechanism (PEP333).</p>
<p>To define the &#8220;100 Continue&#8221; response headers, one may call
<tt class="xref py py-func docutils literal"><span class="pre">set_hundred_continue_response_header()</span></tt> on <tt class="samp docutils literal"><span class="pre">env['wsgi.input']</span></tt>
<code class="xref py py-func docutils literal"><span class="pre">set_hundred_continue_response_header()</span></code> on <code class="samp docutils literal"><span class="pre">env['wsgi.input']</span></code>
as shown in the following example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">wsgi</span>
<span class="kn">import</span> <span class="nn">eventlet</span>
@ -221,18 +221,18 @@ as shown in the following example:</p>
</pre></div>
</div>
<p>You can find a more elaborate example in the file:
<tt class="docutils literal"><span class="pre">tests/wsgi_test.py</span></tt>, <tt class="xref py py-func docutils literal"><span class="pre">test_024a_expect_100_continue_with_headers()</span></tt>.</p>
<code class="docutils literal"><span class="pre">tests/wsgi_test.py</span></code>, <code class="xref py py-func docutils literal"><span class="pre">test_024a_expect_100_continue_with_headers()</span></code>.</p>
<p>Per HTTP RFC 7231 (<a class="reference external" href="http://tools.ietf.org/html/rfc7231#section-6.2">http://tools.ietf.org/html/rfc7231#section-6.2</a>) a client is
required to be able to process one or more 100 continue responses. A sample
use case might be a user protocol where the server may want to use a 100-continue
response to indicate to a client that it is working on a request and the
client should not timeout.</p>
<p>To support multiple 100-continue responses, evenlet wsgi module exports
the API <tt class="xref py py-func docutils literal"><span class="pre">send_hundred_continue_response()</span></tt>.</p>
the API <code class="xref py py-func docutils literal"><span class="pre">send_hundred_continue_response()</span></code>.</p>
<p>Sample use cases for chunked and non-chunked HTTP scenarios are included
in the wsgi test case <tt class="docutils literal"><span class="pre">tests/wsgi_test.py</span></tt>,
<tt class="xref py py-func docutils literal"><span class="pre">test_024b_expect_100_continue_with_headers_multiple_chunked()</span></tt> and
<tt class="xref py py-func docutils literal"><span class="pre">test_024c_expect_100_continue_with_headers_multiple_nonchunked()</span></tt>.</p>
in the wsgi test case <code class="docutils literal"><span class="pre">tests/wsgi_test.py</span></code>,
<code class="xref py py-func docutils literal"><span class="pre">test_024b_expect_100_continue_with_headers_multiple_chunked()</span></code> and
<code class="xref py py-func docutils literal"><span class="pre">test_024c_expect_100_continue_with_headers_multiple_nonchunked()</span></code>.</p>
</div>
</div>
@ -240,11 +240,11 @@ in the wsgi test case <tt class="docutils literal"><span class="pre">tests/wsgi_
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><tt class="docutils literal"><span class="pre">wsgi</span></tt> &#8211; WSGI server</a><ul>
<li><a class="reference internal" href="#"><code class="docutils literal"><span class="pre">wsgi</span></code> &#8211; WSGI server</a><ul>
<li><a class="reference internal" href="#ssl">SSL</a></li>
<li><a class="reference internal" href="#non-standard-extension-to-support-post-hooks">Non-Standard Extension to Support Post Hooks</a></li>
<li><a class="reference internal" href="#continue-response-headers">&#8220;100 Continue&#8221; Response Headers</a></li>
@ -254,16 +254,18 @@ in the wsgi test case <tt class="docutils literal"><span class="pre">tests/wsgi_
<h4>Previous topic</h4>
<p class="topless"><a href="websocket.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">websocket</span></tt> &#8211; Websocket Server</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">websocket</span></code> &#8211; Websocket Server</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="zmq.html"
title="next chapter"><tt class="docutils literal"><span class="pre">eventlet.green.zmq</span></tt> &#8211; ØMQ support</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/wsgi.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
title="next chapter"><code class="docutils literal"><span class="pre">eventlet.green.zmq</span></code> &#8211; ØMQ support</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/wsgi.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -280,7 +282,7 @@ in the wsgi test case <tt class="docutils literal"><span class="pre">tests/wsgi_
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -295,14 +297,14 @@ in the wsgi test case <tt class="docutils literal"><span class="pre">tests/wsgi_
<li class="right" >
<a href="websocket.html" title="websocket Websocket Server"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>eventlet.green.zmq ØMQ support &mdash; Eventlet 0.16.1 documentation</title>
<title>eventlet.green.zmq ØMQ support &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="../index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="../index.html" />
<link rel="up" title="Module Reference" href="../modules.html" />
<link rel="next" title="Authors" href="../authors.html" />
<link rel="prev" title="wsgi WSGI server" href="wsgi.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -44,752 +44,39 @@
<li class="right" >
<a href="wsgi.html" title="wsgi WSGI server"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" accesskey="U">Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="module-eventlet.green.zmq">
<span id="eventlet-green-zmq-omq-support"></span><h1><a class="reference internal" href="#module-eventlet.green.zmq" title="eventlet.green.zmq"><tt class="xref py py-mod docutils literal"><span class="pre">eventlet.green.zmq</span></tt></a> &#8211; ØMQ support<a class="headerlink" href="#module-eventlet.green.zmq" title="Permalink to this headline"></a></h1>
<p>The <a class="reference internal" href="#module-zmq" title="zmq"><tt class="xref py py-mod docutils literal"><span class="pre">zmq</span></tt></a> module wraps the <a class="reference internal" href="#eventlet.green.zmq.Socket" title="eventlet.green.zmq.Socket"><tt class="xref py py-class docutils literal"><span class="pre">Socket</span></tt></a> and <a class="reference internal" href="#eventlet.green.zmq.Context" title="eventlet.green.zmq.Context"><tt class="xref py py-class docutils literal"><span class="pre">Context</span></tt></a>
found in <a class="reference internal" href="#module-zmq" title="zmq"><tt class="xref py py-mod docutils literal"><span class="pre">pyzmq</span></tt></a> to be non blocking</p>
<dl class="function">
<dt id="eventlet.green.zmq.Context">
<tt class="descclassname">eventlet.green.zmq.</tt><tt class="descname">Context</tt><big>(</big><em>io_threads=1</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Context" title="Permalink to this definition"></a></dt>
<dd><p>Subclass of <tt class="xref py py-class docutils literal"><span class="pre">zmq.core.context.Context</span></tt></p>
</dd></dl>
<dl class="class">
<dt id="eventlet.green.zmq.Socket">
<em class="property">class </em><tt class="descclassname">eventlet.green.zmq.</tt><tt class="descname">Socket</tt><big>(</big><em>context</em>, <em>socket_type</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">zmq.sugar.socket.Socket</span></tt></p>
<p>Green version of :class:<a href="#id1"><span class="problematic" id="id2">`</span></a>zmq.core.socket.Socket</p>
<dl class="docutils">
<dt>The following three methods are always overridden:</dt>
<dd><ul class="first last simple">
<li>send</li>
<li>recv</li>
<li>getsockopt</li>
</ul>
</dd>
</dl>
<p>To ensure that the <tt class="docutils literal"><span class="pre">zmq.NOBLOCK</span></tt> flag is set and that sending or recieving
is deferred to the hub (using <a class="reference internal" href="../hubs.html#eventlet.hubs.trampoline" title="eventlet.hubs.trampoline"><tt class="xref py py-func docutils literal"><span class="pre">eventlet.hubs.trampoline()</span></tt></a>) if a
<tt class="docutils literal"><span class="pre">zmq.EAGAIN</span></tt> (retry) error is raised</p>
<dl class="docutils">
<dt>For some socket types, the following methods are also overridden:</dt>
<dd><ul class="first last simple">
<li>send_multipart</li>
<li>recv_multipart</li>
</ul>
</dd>
</dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.recv">
<tt class="descname">recv</tt><big>(</big><em>flags=0</em>, <em>copy=True</em>, <em>track=False</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.recv" title="Permalink to this definition"></a></dt>
<dd><p>Receive a message.</p>
<dl class="docutils">
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>Any supported flag: NOBLOCK. If NOBLOCK is set, this method
will raise a ZMQError with EAGAIN if a message is not ready.
If NOBLOCK is not set, then this method will block until a
message arrives.</dd>
<dt>copy <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd>Should the message be received in a copying or non-copying manner?
If False a Frame object is returned, if True a string copy of
message is returned.</dd>
<dt>track <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd>Should the message be tracked for notification that ZMQ has
finished with it? (ignored if copy=True)</dd>
</dl>
<dl class="docutils">
<dt>msg <span class="classifier-delimiter">:</span> <span class="classifier">bytes, Frame</span></dt>
<dd>The received message frame. If <cite>copy</cite> is False, then it will be a Frame,
otherwise it will be bytes.</dd>
</dl>
<dl class="docutils">
<dt>ZMQError</dt>
<dd>for any of the reasons zmq_msg_recv might fail.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.send">
<tt class="descname">send</tt><big>(</big><em>data</em>, <em>flags=0</em>, <em>copy=True</em>, <em>track=False</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.send" title="Permalink to this definition"></a></dt>
<dd><p>Send a message on this socket.</p>
<p>This queues the message to be sent by the IO thread at a later time.</p>
<dl class="docutils">
<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">object, str, Frame</span></dt>
<dd>The content of the message.</dd>
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>Any supported flag: NOBLOCK, SNDMORE.</dd>
<dt>copy <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd>Should the message be sent in a copying or non-copying manner.</dd>
<dt>track <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd>Should the message be tracked for notification that ZMQ has
finished with it? (ignored if copy=True)</dd>
</dl>
<dl class="docutils">
<dt>None <span class="classifier-delimiter">:</span> <span class="classifier">if <cite>copy</cite> or not track</span></dt>
<dd>None if message was sent, raises an exception otherwise.</dd>
<dt>MessageTracker <span class="classifier-delimiter">:</span> <span class="classifier">if track and not copy</span></dt>
<dd>a MessageTracker object, whose <cite>pending</cite> property will
be True until the send is completed.</dd>
</dl>
<dl class="docutils">
<dt>TypeError</dt>
<dd>If a unicode object is passed</dd>
<dt>ValueError</dt>
<dd>If <cite>track=True</cite>, but an untracked Frame is passed.</dd>
<dt>ZMQError</dt>
<dd>If the send does not succeed for any reason.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.bind">
<tt class="descname">bind</tt><big>(</big><em>addr</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.bind" title="Permalink to this definition"></a></dt>
<dd><p>Bind the socket to an address.</p>
<p>This causes the socket to listen on a network port. Sockets on the
other side of this connection will use <tt class="docutils literal"><span class="pre">Socket.connect(addr)</span></tt> to
connect to this socket.</p>
<dl class="docutils">
<dt>addr <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
<dd>The address string. This has the form &#8216;protocol://interface:port&#8217;,
for example &#8216;tcp://127.0.0.1:5555&#8217;. Protocols supported include
tcp, udp, pgm, epgm, inproc and ipc. If the address is unicode, it is
encoded to utf-8 first.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.bind_to_random_port">
<tt class="descname">bind_to_random_port</tt><big>(</big><em>addr</em>, <em>min_port=49152</em>, <em>max_port=65536</em>, <em>max_tries=100</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.bind_to_random_port" title="Permalink to this definition"></a></dt>
<dd><p>bind this socket to a random port in a range</p>
<dl class="docutils">
<dt>addr <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
<dd>The address string without the port to pass to <tt class="docutils literal"><span class="pre">Socket.bind()</span></tt>.</dd>
<dt>min_port <span class="classifier-delimiter">:</span> <span class="classifier">int, optional</span></dt>
<dd>The minimum port in the range of ports to try (inclusive).</dd>
<dt>max_port <span class="classifier-delimiter">:</span> <span class="classifier">int, optional</span></dt>
<dd>The maximum port in the range of ports to try (exclusive).</dd>
<dt>max_tries <span class="classifier-delimiter">:</span> <span class="classifier">int, optional</span></dt>
<dd>The maximum number of bind attempts to make.</dd>
</dl>
<dl class="docutils">
<dt>port <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>The port the socket was bound to.</dd>
</dl>
<dl class="docutils">
<dt>ZMQBindError</dt>
<dd>if <cite>max_tries</cite> reached before successful bind</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.close">
<tt class="descname">close</tt><big>(</big><em>linger=None</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.close" title="Permalink to this definition"></a></dt>
<dd><p>Close the socket.</p>
<p>If linger is specified, LINGER sockopt will be set prior to closing.</p>
<p>This can be called to close the socket by hand. If this is not
called, the socket will automatically be closed when it is
garbage collected.</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.connect">
<tt class="descname">connect</tt><big>(</big><em>addr</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.connect" title="Permalink to this definition"></a></dt>
<dd><p>Connect to a remote 0MQ socket.</p>
<dl class="docutils">
<dt>addr <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
<dd>The address string. This has the form &#8216;protocol://interface:port&#8217;,
for example &#8216;tcp://127.0.0.1:5555&#8217;. Protocols supported are
tcp, upd, pgm, inproc and ipc. If the address is unicode, it is
encoded to utf-8 first.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.disable_monitor">
<tt class="descname">disable_monitor</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.disable_monitor" title="Permalink to this definition"></a></dt>
<dd><p>Shutdown the PAIR socket (created using get_monitor_socket)
that is serving socket events.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 14.4.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.disconnect">
<tt class="descname">disconnect</tt><big>(</big><em>addr</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.disconnect" title="Permalink to this definition"></a></dt>
<dd><p>Disconnect from a remote 0MQ socket (undoes a call to connect).</p>
<div class="versionadded">
<p><span class="versionmodified">New in version libzmq-3.2.</span></p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 13.0.</span></p>
</div>
<dl class="docutils">
<dt>addr <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
<dd>The address string. This has the form &#8216;protocol://interface:port&#8217;,
for example &#8216;tcp://127.0.0.1:5555&#8217;. Protocols supported are
tcp, upd, pgm, inproc and ipc. If the address is unicode, it is
encoded to utf-8 first.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.get">
<tt class="descname">get</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.get" title="Permalink to this definition"></a></dt>
<dd><p>Get the value of a socket option.</p>
<p>See the 0MQ API documentation for details on specific options.</p>
<dl class="docutils">
<dt>option <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first">The option to get. Available values will depend on your
version of libzmq. Examples include:</p>
<div class="last highlight-python"><div class="highlight"><pre><span class="n">zmq</span><span class="o">.</span><span class="n">IDENTITY</span><span class="p">,</span> <span class="n">HWM</span><span class="p">,</span> <span class="n">LINGER</span><span class="p">,</span> <span class="n">FD</span><span class="p">,</span> <span class="n">EVENTS</span>
</pre></div>
</div>
</dd>
</dl>
<dl class="docutils">
<dt>optval <span class="classifier-delimiter">:</span> <span class="classifier">int or bytes</span></dt>
<dd>The value of the option as a bytestring or int.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.get_hwm">
<tt class="descname">get_hwm</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.get_hwm" title="Permalink to this definition"></a></dt>
<dd><p>get the High Water Mark</p>
<p>On libzmq ≥ 3, this gets SNDHWM if available, otherwise RCVHWM</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.get_monitor_socket">
<tt class="descname">get_monitor_socket</tt><big>(</big><em>events=None</em>, <em>addr=None</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.get_monitor_socket" title="Permalink to this definition"></a></dt>
<dd><p>Return a connected PAIR socket ready to receive the event notifications.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version libzmq-4.0.</span></p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 14.0.</span></p>
</div>
<dl class="docutils">
<dt>events <span class="classifier-delimiter">:</span> <span class="classifier">bitfield (int) [default: ZMQ_EVENTS_ALL]</span></dt>
<dd>The bitmask defining which events are wanted.</dd>
<dt>addr <span class="classifier-delimiter">:</span> <span class="classifier">string [default: None]</span></dt>
<dd>The optional endpoint for the monitoring sockets.</dd>
</dl>
<dl class="docutils">
<dt>socket <span class="classifier-delimiter">:</span> <span class="classifier">(PAIR)</span></dt>
<dd>The socket is already connected and ready to receive messages.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.get_string">
<tt class="descname">get_string</tt><big>(</big><em>option</em>, <em>encoding='utf-8'</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.get_string" title="Permalink to this definition"></a></dt>
<dd><p>get the value of a socket option</p>
<p>See the 0MQ documentation for details on specific options.</p>
<dl class="docutils">
<dt>option <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>The option to retrieve.</dd>
</dl>
<dl class="docutils">
<dt>optval <span class="classifier-delimiter">:</span> <span class="classifier">unicode string (unicode on py2, str on py3)</span></dt>
<dd>The value of the option as a unicode string.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.getsockopt">
<tt class="descname">getsockopt</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.getsockopt" title="Permalink to this definition"></a></dt>
<dd><p>s.get(option)</p>
<p>Get the value of a socket option.</p>
<p>See the 0MQ API documentation for details on specific options.</p>
<dl class="docutils">
<dt>option <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first">The option to get. Available values will depend on your
version of libzmq. Examples include:</p>
<div class="last highlight-python"><div class="highlight"><pre><span class="n">zmq</span><span class="o">.</span><span class="n">IDENTITY</span><span class="p">,</span> <span class="n">HWM</span><span class="p">,</span> <span class="n">LINGER</span><span class="p">,</span> <span class="n">FD</span><span class="p">,</span> <span class="n">EVENTS</span>
</pre></div>
</div>
</dd>
</dl>
<dl class="docutils">
<dt>optval <span class="classifier-delimiter">:</span> <span class="classifier">int or bytes</span></dt>
<dd>The value of the option as a bytestring or int.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.getsockopt_string">
<tt class="descname">getsockopt_string</tt><big>(</big><em>option</em>, <em>encoding='utf-8'</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.getsockopt_string" title="Permalink to this definition"></a></dt>
<dd><p>get the value of a socket option</p>
<p>See the 0MQ documentation for details on specific options.</p>
<dl class="docutils">
<dt>option <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>The option to retrieve.</dd>
</dl>
<dl class="docutils">
<dt>optval <span class="classifier-delimiter">:</span> <span class="classifier">unicode string (unicode on py2, str on py3)</span></dt>
<dd>The value of the option as a unicode string.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.getsockopt_unicode">
<tt class="descname">getsockopt_unicode</tt><big>(</big><em>option</em>, <em>encoding='utf-8'</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.getsockopt_unicode" title="Permalink to this definition"></a></dt>
<dd><p>get the value of a socket option</p>
<p>See the 0MQ documentation for details on specific options.</p>
<dl class="docutils">
<dt>option <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>The option to retrieve.</dd>
</dl>
<dl class="docutils">
<dt>optval <span class="classifier-delimiter">:</span> <span class="classifier">unicode string (unicode on py2, str on py3)</span></dt>
<dd>The value of the option as a unicode string.</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="eventlet.green.zmq.Socket.hwm">
<tt class="descname">hwm</tt><a class="headerlink" href="#eventlet.green.zmq.Socket.hwm" title="Permalink to this definition"></a></dt>
<dd><p>get the High Water Mark</p>
<p>On libzmq ≥ 3, this gets SNDHWM if available, otherwise RCVHWM</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.monitor">
<tt class="descname">monitor</tt><big>(</big><em>addr</em>, <em>flags</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.monitor" title="Permalink to this definition"></a></dt>
<dd><p>Start publishing socket events on inproc.
See libzmq docs for zmq_monitor for details.</p>
<p>While this function is available from libzmq 3.2,
pyzmq cannot parse monitor messages from libzmq prior to 4.0.</p>
<dl class="docutils">
<dt>addr <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
<dd>The inproc url used for monitoring. Passing None as
the addr will cause an existing socket monitor to be
deregistered.</dd>
<dt>events <span class="classifier-delimiter">:</span> <span class="classifier">int [default: zmq.EVENT_ALL]</span></dt>
<dd>The zmq event bitmask for which events will be sent to the monitor.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.poll">
<tt class="descname">poll</tt><big>(</big><em>timeout=None</em>, <em>flags=1</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.poll" title="Permalink to this definition"></a></dt>
<dd><p>poll the socket for events</p>
<p>The default is to poll forever for incoming
events. Timeout is in milliseconds, if specified.</p>
<dl class="docutils">
<dt>timeout <span class="classifier-delimiter">:</span> <span class="classifier">int [default: None]</span></dt>
<dd>The timeout (in milliseconds) to wait for an event. If unspecified
(or specified None), will wait forever for an event.</dd>
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">bitfield (int) [default: POLLIN]</span></dt>
<dd>The event flags to poll for (any combination of POLLIN|POLLOUT).
The default is to check for incoming events (POLLIN).</dd>
</dl>
<dl class="docutils">
<dt>events <span class="classifier-delimiter">:</span> <span class="classifier">bitfield (int)</span></dt>
<dd>The events that are ready and waiting. Will be 0 if no events were ready
by the time timeout was reached.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt>
<tt class="descname">recv</tt><big>(</big><em>flags=0</em>, <em>copy=True</em>, <em>track=False</em><big>)</big></dt>
<dd><p>Receive a message.</p>
<dl class="docutils">
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>Any supported flag: NOBLOCK. If NOBLOCK is set, this method
will raise a ZMQError with EAGAIN if a message is not ready.
If NOBLOCK is not set, then this method will block until a
message arrives.</dd>
<dt>copy <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd>Should the message be received in a copying or non-copying manner?
If False a Frame object is returned, if True a string copy of
message is returned.</dd>
<dt>track <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd>Should the message be tracked for notification that ZMQ has
finished with it? (ignored if copy=True)</dd>
</dl>
<dl class="docutils">
<dt>msg <span class="classifier-delimiter">:</span> <span class="classifier">bytes, Frame</span></dt>
<dd>The received message frame. If <cite>copy</cite> is False, then it will be a Frame,
otherwise it will be bytes.</dd>
</dl>
<dl class="docutils">
<dt>ZMQError</dt>
<dd>for any of the reasons zmq_msg_recv might fail.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.recv_json">
<tt class="descname">recv_json</tt><big>(</big><em>flags=0</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.recv_json" title="Permalink to this definition"></a></dt>
<dd><p>receive a Python object as a message using json to serialize</p>
<p>Keyword arguments are passed on to json.loads</p>
<dl class="docutils">
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>Any valid recv flag.</dd>
</dl>
<dl class="docutils">
<dt>obj <span class="classifier-delimiter">:</span> <span class="classifier">Python object</span></dt>
<dd>The Python object that arrives as a message.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.recv_multipart">
<tt class="descname">recv_multipart</tt><big>(</big><em>flags=0</em>, <em>copy=True</em>, <em>track=False</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.recv_multipart" title="Permalink to this definition"></a></dt>
<dd><p>receive a multipart message as a list of bytes or Frame objects</p>
<dl class="docutils">
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int, optional</span></dt>
<dd>Any supported flag: NOBLOCK. If NOBLOCK is set, this method
will raise a ZMQError with EAGAIN if a message is not ready.
If NOBLOCK is not set, then this method will block until a
message arrives.</dd>
<dt>copy <span class="classifier-delimiter">:</span> <span class="classifier">bool, optional</span></dt>
<dd>Should the message frame(s) be received in a copying or non-copying manner?
If False a Frame object is returned for each part, if True a copy of
the bytes is made for each frame.</dd>
<dt>track <span class="classifier-delimiter">:</span> <span class="classifier">bool, optional</span></dt>
<dd>Should the message frame(s) be tracked for notification that ZMQ has
finished with it? (ignored if copy=True)</dd>
</dl>
<dl class="docutils">
<dt>msg_parts <span class="classifier-delimiter">:</span> <span class="classifier">list</span></dt>
<dd>A list of frames in the multipart message; either Frames or bytes,
depending on <cite>copy</cite>.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.recv_pyobj">
<tt class="descname">recv_pyobj</tt><big>(</big><em>flags=0</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.recv_pyobj" title="Permalink to this definition"></a></dt>
<dd><p>receive a Python object as a message using pickle to serialize</p>
<dl class="docutils">
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>Any valid recv flag.</dd>
</dl>
<dl class="docutils">
<dt>obj <span class="classifier-delimiter">:</span> <span class="classifier">Python object</span></dt>
<dd>The Python object that arrives as a message.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.recv_string">
<tt class="descname">recv_string</tt><big>(</big><em>flags=0</em>, <em>encoding='utf-8'</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.recv_string" title="Permalink to this definition"></a></dt>
<dd><p>receive a unicode string, as sent by send_string</p>
<dl class="docutils">
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>Any valid recv flag.</dd>
<dt>encoding <span class="classifier-delimiter">:</span> <span class="classifier">str [default: &#8216;utf-8&#8217;]</span></dt>
<dd>The encoding to be used</dd>
</dl>
<dl class="docutils">
<dt>s <span class="classifier-delimiter">:</span> <span class="classifier">unicode string (unicode on py2, str on py3)</span></dt>
<dd>The Python unicode string that arrives as encoded bytes.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.recv_unicode">
<tt class="descname">recv_unicode</tt><big>(</big><em>flags=0</em>, <em>encoding='utf-8'</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.recv_unicode" title="Permalink to this definition"></a></dt>
<dd><p>receive a unicode string, as sent by send_string</p>
<dl class="docutils">
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>Any valid recv flag.</dd>
<dt>encoding <span class="classifier-delimiter">:</span> <span class="classifier">str [default: &#8216;utf-8&#8217;]</span></dt>
<dd>The encoding to be used</dd>
</dl>
<dl class="docutils">
<dt>s <span class="classifier-delimiter">:</span> <span class="classifier">unicode string (unicode on py2, str on py3)</span></dt>
<dd>The Python unicode string that arrives as encoded bytes.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt>
<tt class="descname">send</tt><big>(</big><em>data</em>, <em>flags=0</em>, <em>copy=True</em>, <em>track=False</em><big>)</big></dt>
<dd><p>Send a message on this socket.</p>
<p>This queues the message to be sent by the IO thread at a later time.</p>
<dl class="docutils">
<dt>data <span class="classifier-delimiter">:</span> <span class="classifier">object, str, Frame</span></dt>
<dd>The content of the message.</dd>
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>Any supported flag: NOBLOCK, SNDMORE.</dd>
<dt>copy <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd>Should the message be sent in a copying or non-copying manner.</dd>
<dt>track <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd>Should the message be tracked for notification that ZMQ has
finished with it? (ignored if copy=True)</dd>
</dl>
<dl class="docutils">
<dt>None <span class="classifier-delimiter">:</span> <span class="classifier">if <cite>copy</cite> or not track</span></dt>
<dd>None if message was sent, raises an exception otherwise.</dd>
<dt>MessageTracker <span class="classifier-delimiter">:</span> <span class="classifier">if track and not copy</span></dt>
<dd>a MessageTracker object, whose <cite>pending</cite> property will
be True until the send is completed.</dd>
</dl>
<dl class="docutils">
<dt>TypeError</dt>
<dd>If a unicode object is passed</dd>
<dt>ValueError</dt>
<dd>If <cite>track=True</cite>, but an untracked Frame is passed.</dd>
<dt>ZMQError</dt>
<dd>If the send does not succeed for any reason.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.send_json">
<tt class="descname">send_json</tt><big>(</big><em>obj</em>, <em>flags=0</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.send_json" title="Permalink to this definition"></a></dt>
<dd><p>send a Python object as a message using json to serialize</p>
<p>Keyword arguments are passed on to json.dumps</p>
<dl class="docutils">
<dt>obj <span class="classifier-delimiter">:</span> <span class="classifier">Python object</span></dt>
<dd>The Python object to send</dd>
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>Any valid send flag</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.send_multipart">
<tt class="descname">send_multipart</tt><big>(</big><em>msg_parts</em>, <em>flags=0</em>, <em>copy=True</em>, <em>track=False</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.send_multipart" title="Permalink to this definition"></a></dt>
<dd><p>send a sequence of buffers as a multipart message</p>
<p>The zmq.SNDMORE flag is added to all msg parts before the last.</p>
<dl class="docutils">
<dt>msg_parts <span class="classifier-delimiter">:</span> <span class="classifier">iterable</span></dt>
<dd>A sequence of objects to send as a multipart message. Each element
can be any sendable object (Frame, bytes, buffer-providers)</dd>
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int, optional</span></dt>
<dd>SNDMORE is handled automatically for frames before the last.</dd>
<dt>copy <span class="classifier-delimiter">:</span> <span class="classifier">bool, optional</span></dt>
<dd>Should the frame(s) be sent in a copying or non-copying manner.</dd>
<dt>track <span class="classifier-delimiter">:</span> <span class="classifier">bool, optional</span></dt>
<dd>Should the frame(s) be tracked for notification that ZMQ has
finished with it (ignored if copy=True).</dd>
</dl>
<p>None : if copy or not track
MessageTracker : if track and not copy</p>
<blockquote>
<div>a MessageTracker object, whose <cite>pending</cite> property will
be True until the last send is completed.</div></blockquote>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.send_pyobj">
<tt class="descname">send_pyobj</tt><big>(</big><em>obj</em>, <em>flags=0</em>, <em>protocol=-1</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.send_pyobj" title="Permalink to this definition"></a></dt>
<dd><p>send a Python object as a message using pickle to serialize</p>
<dl class="docutils">
<dt>obj <span class="classifier-delimiter">:</span> <span class="classifier">Python object</span></dt>
<dd>The Python object to send.</dd>
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>Any valid send flag.</dd>
<dt>protocol <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>The pickle protocol number to use. Default of -1 will select
the highest supported number. Use 0 for multiple platform
support.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.send_string">
<tt class="descname">send_string</tt><big>(</big><em>u</em>, <em>flags=0</em>, <em>copy=True</em>, <em>encoding='utf-8'</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.send_string" title="Permalink to this definition"></a></dt>
<dd><p>send a Python unicode string as a message with an encoding</p>
<p>0MQ communicates with raw bytes, so you must encode/decode
text (unicode on py2, str on py3) around 0MQ.</p>
<dl class="docutils">
<dt>u <span class="classifier-delimiter">:</span> <span class="classifier">Python unicode string (unicode on py2, str on py3)</span></dt>
<dd>The unicode string to send.</dd>
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int, optional</span></dt>
<dd>Any valid send flag.</dd>
<dt>encoding <span class="classifier-delimiter">:</span> <span class="classifier">str [default: &#8216;utf-8&#8217;]</span></dt>
<dd>The encoding to be used</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.send_unicode">
<tt class="descname">send_unicode</tt><big>(</big><em>u</em>, <em>flags=0</em>, <em>copy=True</em>, <em>encoding='utf-8'</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.send_unicode" title="Permalink to this definition"></a></dt>
<dd><p>send a Python unicode string as a message with an encoding</p>
<p>0MQ communicates with raw bytes, so you must encode/decode
text (unicode on py2, str on py3) around 0MQ.</p>
<dl class="docutils">
<dt>u <span class="classifier-delimiter">:</span> <span class="classifier">Python unicode string (unicode on py2, str on py3)</span></dt>
<dd>The unicode string to send.</dd>
<dt>flags <span class="classifier-delimiter">:</span> <span class="classifier">int, optional</span></dt>
<dd>Any valid send flag.</dd>
<dt>encoding <span class="classifier-delimiter">:</span> <span class="classifier">str [default: &#8216;utf-8&#8217;]</span></dt>
<dd>The encoding to be used</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.set">
<tt class="descname">set</tt><big>(</big><em>option</em>, <em>optval</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.set" title="Permalink to this definition"></a></dt>
<dd><p>Set socket options.</p>
<p>See the 0MQ API documentation for details on specific options.</p>
<dl class="docutils">
<dt>option <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first">The option to set. Available values will depend on your
version of libzmq. Examples include:</p>
<div class="last highlight-python"><div class="highlight"><pre><span class="n">zmq</span><span class="o">.</span><span class="n">SUBSCRIBE</span><span class="p">,</span> <span class="n">UNSUBSCRIBE</span><span class="p">,</span> <span class="n">IDENTITY</span><span class="p">,</span> <span class="n">HWM</span><span class="p">,</span> <span class="n">LINGER</span><span class="p">,</span> <span class="n">FD</span>
</pre></div>
</div>
</dd>
<dt>optval <span class="classifier-delimiter">:</span> <span class="classifier">int or bytes</span></dt>
<dd>The value of the option to set.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.set_hwm">
<tt class="descname">set_hwm</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.set_hwm" title="Permalink to this definition"></a></dt>
<dd><p>set the High Water Mark</p>
<p>On libzmq ≥ 3, this sets both SNDHWM and RCVHWM</p>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.set_string">
<tt class="descname">set_string</tt><big>(</big><em>option</em>, <em>optval</em>, <em>encoding='utf-8'</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.set_string" title="Permalink to this definition"></a></dt>
<dd><p>set socket options with a unicode object</p>
<p>This is simply a wrapper for setsockopt to protect from encoding ambiguity.</p>
<p>See the 0MQ documentation for details on specific options.</p>
<dl class="docutils">
<dt>option <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>The name of the option to set. Can be any of: SUBSCRIBE,
UNSUBSCRIBE, IDENTITY</dd>
<dt>optval <span class="classifier-delimiter">:</span> <span class="classifier">unicode string (unicode on py2, str on py3)</span></dt>
<dd>The value of the option to set.</dd>
<dt>encoding <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
<dd>The encoding to be used, default is utf8</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.setsockopt">
<tt class="descname">setsockopt</tt><big>(</big><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.setsockopt" title="Permalink to this definition"></a></dt>
<dd><p>s.set(option, optval)</p>
<p>Set socket options.</p>
<p>See the 0MQ API documentation for details on specific options.</p>
<dl class="docutils">
<dt>option <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first">The option to set. Available values will depend on your
version of libzmq. Examples include:</p>
<div class="last highlight-python"><div class="highlight"><pre><span class="n">zmq</span><span class="o">.</span><span class="n">SUBSCRIBE</span><span class="p">,</span> <span class="n">UNSUBSCRIBE</span><span class="p">,</span> <span class="n">IDENTITY</span><span class="p">,</span> <span class="n">HWM</span><span class="p">,</span> <span class="n">LINGER</span><span class="p">,</span> <span class="n">FD</span>
</pre></div>
</div>
</dd>
<dt>optval <span class="classifier-delimiter">:</span> <span class="classifier">int or bytes</span></dt>
<dd>The value of the option to set.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.setsockopt_string">
<tt class="descname">setsockopt_string</tt><big>(</big><em>option</em>, <em>optval</em>, <em>encoding='utf-8'</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.setsockopt_string" title="Permalink to this definition"></a></dt>
<dd><p>set socket options with a unicode object</p>
<p>This is simply a wrapper for setsockopt to protect from encoding ambiguity.</p>
<p>See the 0MQ documentation for details on specific options.</p>
<dl class="docutils">
<dt>option <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>The name of the option to set. Can be any of: SUBSCRIBE,
UNSUBSCRIBE, IDENTITY</dd>
<dt>optval <span class="classifier-delimiter">:</span> <span class="classifier">unicode string (unicode on py2, str on py3)</span></dt>
<dd>The value of the option to set.</dd>
<dt>encoding <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
<dd>The encoding to be used, default is utf8</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.setsockopt_unicode">
<tt class="descname">setsockopt_unicode</tt><big>(</big><em>option</em>, <em>optval</em>, <em>encoding='utf-8'</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.setsockopt_unicode" title="Permalink to this definition"></a></dt>
<dd><p>set socket options with a unicode object</p>
<p>This is simply a wrapper for setsockopt to protect from encoding ambiguity.</p>
<p>See the 0MQ documentation for details on specific options.</p>
<dl class="docutils">
<dt>option <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd>The name of the option to set. Can be any of: SUBSCRIBE,
UNSUBSCRIBE, IDENTITY</dd>
<dt>optval <span class="classifier-delimiter">:</span> <span class="classifier">unicode string (unicode on py2, str on py3)</span></dt>
<dd>The value of the option to set.</dd>
<dt>encoding <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
<dd>The encoding to be used, default is utf8</dd>
</dl>
</dd></dl>
<dl class="classmethod">
<dt id="eventlet.green.zmq.Socket.shadow">
<em class="property">classmethod </em><tt class="descname">shadow</tt><big>(</big><em>address</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.shadow" title="Permalink to this definition"></a></dt>
<dd><p>Shadow an existing libzmq socket</p>
<p>address is the integer address of the libzmq socket
or an FFI pointer to it.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 14.1.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="eventlet.green.zmq.Socket.unbind">
<tt class="descname">unbind</tt><big>(</big><em>addr</em><big>)</big><a class="headerlink" href="#eventlet.green.zmq.Socket.unbind" title="Permalink to this definition"></a></dt>
<dd><p>Unbind from an address (undoes a call to bind).</p>
<div class="versionadded">
<p><span class="versionmodified">New in version libzmq-3.2.</span></p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 13.0.</span></p>
</div>
<dl class="docutils">
<dt>addr <span class="classifier-delimiter">:</span> <span class="classifier">str</span></dt>
<dd>The address string. This has the form &#8216;protocol://interface:port&#8217;,
for example &#8216;tcp://127.0.0.1:5555&#8217;. Protocols supported are
tcp, upd, pgm, inproc and ipc. If the address is unicode, it is
encoded to utf-8 first.</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="eventlet.green.zmq.Socket.underlying">
<tt class="descname">underlying</tt><a class="headerlink" href="#eventlet.green.zmq.Socket.underlying" title="Permalink to this definition"></a></dt>
<dd><p>The address of the underlying libzmq socket</p>
</dd></dl>
</dd></dl>
<div class="section" id="eventlet-green-zmq-omq-support">
<h1><code class="xref py py-mod docutils literal"><span class="pre">eventlet.green.zmq</span></code> &#8211; ØMQ support<a class="headerlink" href="#eventlet-green-zmq-omq-support" title="Permalink to this headline"></a></h1>
<span class="target" id="module-zmq"></span></div>
<div class="section" id="zmq-the-pyzmq-omq-python-bindings">
<h1><a class="reference internal" href="#module-zmq" title="zmq"><tt class="xref py py-mod docutils literal"><span class="pre">zmq</span></tt></a> &#8211; The pyzmq ØMQ python bindings<a class="headerlink" href="#zmq-the-pyzmq-omq-python-bindings" title="Permalink to this headline"></a></h1>
<p><a class="reference internal" href="#module-zmq" title="zmq"><tt class="xref py py-mod docutils literal"><span class="pre">pyzmq</span></tt></a> <a class="footnote-reference" href="#id6" id="id3">[1]</a> Is a python binding to the C++ ØMQ <a class="footnote-reference" href="#id7" id="id4">[2]</a> library written in Cython <a class="footnote-reference" href="#id8" id="id5">[3]</a>. The following is
auto generated <a class="reference internal" href="#module-zmq" title="zmq"><tt class="xref py py-mod docutils literal"><span class="pre">pyzmq's</span></tt></a> from documentation.</p>
<h1><a class="reference internal" href="#module-zmq" title="zmq"><code class="xref py py-mod docutils literal"><span class="pre">zmq</span></code></a> &#8211; The pyzmq ØMQ python bindings<a class="headerlink" href="#zmq-the-pyzmq-omq-python-bindings" title="Permalink to this headline"></a></h1>
<p><a class="reference internal" href="#module-zmq" title="zmq"><code class="xref py py-mod docutils literal"><span class="pre">pyzmq</span></code></a> <a class="footnote-reference" href="#id4" id="id1">[1]</a> Is a python binding to the C++ ØMQ <a class="footnote-reference" href="#id5" id="id2">[2]</a> library written in Cython <a class="footnote-reference" href="#id6" id="id3">[3]</a>. The following is
auto generated <a class="reference internal" href="#module-zmq" title="zmq"><code class="xref py py-mod docutils literal"><span class="pre">pyzmq's</span></code></a> from documentation.</p>
<table class="docutils footnote" frame="void" id="id4" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td><a class="reference external" href="http://github.com/zeromq/pyzmq">http://github.com/zeromq/pyzmq</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id5" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td><a class="reference external" href="http://www.zeromq.com">http://www.zeromq.com</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id6" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[1]</a></td><td><a class="reference external" href="http://github.com/zeromq/pyzmq">http://github.com/zeromq/pyzmq</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id7" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id4">[2]</a></td><td><a class="reference external" href="http://www.zeromq.com">http://www.zeromq.com</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id8" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id5">[3]</a></td><td><a class="reference external" href="http://www.cython.org">http://www.cython.org</a></td></tr>
<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td><a class="reference external" href="http://www.cython.org">http://www.cython.org</a></td></tr>
</tbody>
</table>
</div>
@ -798,26 +85,28 @@ auto generated <a class="reference internal" href="#module-zmq" title="zmq"><tt
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><tt class="docutils literal"><span class="pre">eventlet.green.zmq</span></tt> &#8211; ØMQ support</a></li>
<li><a class="reference internal" href="#zmq-the-pyzmq-omq-python-bindings"><tt class="docutils literal"><span class="pre">zmq</span></tt> &#8211; The pyzmq ØMQ python bindings</a></li>
<li><a class="reference internal" href="#"><code class="docutils literal"><span class="pre">eventlet.green.zmq</span></code> &#8211; ØMQ support</a></li>
<li><a class="reference internal" href="#zmq-the-pyzmq-omq-python-bindings"><code class="docutils literal"><span class="pre">zmq</span></code> &#8211; The pyzmq ØMQ python bindings</a></li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="wsgi.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">wsgi</span></tt> &#8211; WSGI server</a></p>
title="previous chapter"><code class="docutils literal"><span class="pre">wsgi</span></code> &#8211; WSGI server</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="../authors.html"
title="next chapter">Authors</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/zmq.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/zmq.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
@ -834,7 +123,7 @@ auto generated <a class="reference internal" href="#module-zmq" title="zmq"><tt
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -849,14 +138,14 @@ auto generated <a class="reference internal" href="#module-zmq" title="zmq"><tt
<li class="right" >
<a href="wsgi.html" title="wsgi WSGI server"
>previous</a> |</li>
<li><a href="../index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li><a href="../modules.html" >Module Reference</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="../index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
<li class="nav-item nav-item-1"><a href="../modules.html" >Module Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

Binary file not shown.

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Greening The World &mdash; Eventlet 0.16.1 documentation</title>
<title>Greening The World &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="Examples" href="examples.html" />
<link rel="prev" title="Design Patterns" href="design_patterns.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,14 +43,14 @@
<li class="right" >
<a href="design_patterns.html" title="Design Patterns"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="greening-the-world">
<h1>Greening The World<a class="headerlink" href="#greening-the-world" title="Permalink to this headline"></a></h1>
@ -58,16 +58,16 @@
<p>Therefore, the application using Eventlet must explicitly green the world for itself, using one or both of the convenient methods provided.</p>
<div class="section" id="import-green">
<span id="id1"></span><h2>Import Green<a class="headerlink" href="#import-green" title="Permalink to this headline"></a></h2>
<p>The first way of greening an application is to import networking-related libraries from the <tt class="docutils literal"><span class="pre">eventlet.green</span></tt> package. It contains libraries that have the same interfaces as common standard ones, but they are modified to behave well with green threads. Using this method is a good engineering practice, because the true dependencies are apparent in every file:</p>
<p>The first way of greening an application is to import networking-related libraries from the <code class="docutils literal"><span class="pre">eventlet.green</span></code> package. It contains libraries that have the same interfaces as common standard ones, but they are modified to behave well with green threads. Using this method is a good engineering practice, because the true dependencies are apparent in every file:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">eventlet.green</span> <span class="kn">import</span> <span class="n">socket</span>
<span class="kn">from</span> <span class="nn">eventlet.green</span> <span class="kn">import</span> <span class="n">threading</span>
<span class="kn">from</span> <span class="nn">eventlet.green</span> <span class="kn">import</span> <span class="n">asyncore</span>
</pre></div>
</div>
<p>This works best if every library can be imported green in this manner. If <tt class="docutils literal"><span class="pre">eventlet.green</span></tt> lacks a module (for example, non-python-standard modules), then <a class="reference internal" href="#eventlet.patcher.import_patched" title="eventlet.patcher.import_patched"><tt class="xref py py-func docutils literal"><span class="pre">import_patched()</span></tt></a> function can come to the rescue. It is a replacement for the builtin import statement that greens any module on import.</p>
<p>This works best if every library can be imported green in this manner. If <code class="docutils literal"><span class="pre">eventlet.green</span></code> lacks a module (for example, non-python-standard modules), then <a class="reference internal" href="#eventlet.patcher.import_patched" title="eventlet.patcher.import_patched"><code class="xref py py-func docutils literal"><span class="pre">import_patched()</span></code></a> function can come to the rescue. It is a replacement for the builtin import statement that greens any module on import.</p>
<dl class="function">
<dt id="eventlet.patcher.import_patched">
<tt class="descclassname">eventlet.patcher.</tt><tt class="descname">import_patched</tt><big>(</big><em>module_name</em>, <em>*additional_modules</em>, <em>**kw_additional_modules</em><big>)</big><a class="headerlink" href="#eventlet.patcher.import_patched" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.patcher.</code><code class="descname">import_patched</code><span class="sig-paren">(</span><em>module_name</em>, <em>*additional_modules</em>, <em>**kw_additional_modules</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.patcher.import_patched" title="Permalink to this definition"></a></dt>
<dd><p>Imports a module in a greened manner, so that the module&#8217;s use of networking libraries like socket will use Eventlet&#8217;s green versions instead. The only required argument is the name of the module to be imported:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">eventlet</span>
<span class="n">httplib2</span> <span class="o">=</span> <span class="n">eventlet</span><span class="o">.</span><span class="n">import_patched</span><span class="p">(</span><span class="s">&#39;httplib2&#39;</span><span class="p">)</span>
@ -93,28 +93,28 @@
library. This has the disadvantage of appearing quite magical, but the advantage of avoiding the late-binding problem.</p>
<dl class="function">
<dt id="eventlet.patcher.monkey_patch">
<tt class="descclassname">eventlet.patcher.</tt><tt class="descname">monkey_patch</tt><big>(</big><em>os=None</em>, <em>select=None</em>, <em>socket=None</em>, <em>thread=None</em>, <em>time=None</em>, <em>psycopg=None</em><big>)</big><a class="headerlink" href="#eventlet.patcher.monkey_patch" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.patcher.</code><code class="descname">monkey_patch</code><span class="sig-paren">(</span><em>os=None</em>, <em>select=None</em>, <em>socket=None</em>, <em>thread=None</em>, <em>time=None</em>, <em>psycopg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.patcher.monkey_patch" title="Permalink to this definition"></a></dt>
<dd><p>This function monkeypatches the key system modules by replacing their key elements with green equivalents. If no arguments are specified, everything is patched:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">eventlet</span>
<span class="n">eventlet</span><span class="o">.</span><span class="n">monkey_patch</span><span class="p">()</span>
</pre></div>
</div>
<p>The keyword arguments afford some control over which modules are patched, in case that&#8217;s important. Most patch the single module of the same name (e.g. time=True means that the time module is patched [time.sleep is patched by eventlet.sleep]). The exceptions to this rule are <em>socket</em>, which also patches the <a class="reference external" href="http://docs.python.org/library/ssl.html#module-ssl" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">ssl</span></tt></a> module if present; and <em>thread</em>, which patches <a class="reference external" href="http://docs.python.org/library/thread.html#module-thread" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">thread</span></tt></a>, <a class="reference external" href="http://docs.python.org/library/threading.html#module-threading" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">threading</span></tt></a>, and <a class="reference external" href="http://docs.python.org/library/queue.html#module-Queue" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">Queue</span></tt></a>.</p>
<p>The keyword arguments afford some control over which modules are patched, in case that&#8217;s important. Most patch the single module of the same name (e.g. time=True means that the time module is patched [time.sleep is patched by eventlet.sleep]). The exceptions to this rule are <em>socket</em>, which also patches the <a class="reference external" href="http://docs.python.org/library/ssl.html#module-ssl" title="(in Python v2.7)"><code class="xref py py-mod docutils literal"><span class="pre">ssl</span></code></a> module if present; and <em>thread</em>, which patches <a class="reference external" href="http://docs.python.org/library/thread.html#module-thread" title="(in Python v2.7)"><code class="xref py py-mod docutils literal"><span class="pre">thread</span></code></a>, <a class="reference external" href="http://docs.python.org/library/threading.html#module-threading" title="(in Python v2.7)"><code class="xref py py-mod docutils literal"><span class="pre">threading</span></code></a>, and <a class="reference external" href="http://docs.python.org/library/queue.html#module-Queue" title="(in Python v2.7)"><code class="xref py py-mod docutils literal"><span class="pre">Queue</span></code></a>.</p>
<p>Here&#8217;s an example of using monkey_patch to patch only a few modules:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">eventlet</span>
<span class="n">eventlet</span><span class="o">.</span><span class="n">monkey_patch</span><span class="p">(</span><span class="n">socket</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">select</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</pre></div>
</div>
<p>It is important to call <a class="reference internal" href="#eventlet.patcher.monkey_patch" title="eventlet.patcher.monkey_patch"><tt class="xref py py-func docutils literal"><span class="pre">monkey_patch()</span></tt></a> as early in the lifetime of the application as possible. Try to do it as one of the first lines in the main module. The reason for this is that sometimes there is a class that inherits from a class that needs to be greened &#8211; e.g. a class that inherits from socket.socket &#8211; and inheritance is done at import time, so therefore the monkeypatching should happen before the derived class is defined. It&#8217;s safe to call monkey_patch multiple times.</p>
<p>It is important to call <a class="reference internal" href="#eventlet.patcher.monkey_patch" title="eventlet.patcher.monkey_patch"><code class="xref py py-func docutils literal"><span class="pre">monkey_patch()</span></code></a> as early in the lifetime of the application as possible. Try to do it as one of the first lines in the main module. The reason for this is that sometimes there is a class that inherits from a class that needs to be greened &#8211; e.g. a class that inherits from socket.socket &#8211; and inheritance is done at import time, so therefore the monkeypatching should happen before the derived class is defined. It&#8217;s safe to call monkey_patch multiple times.</p>
<p>The psycopg monkeypatching relies on Daniele Varrazzo&#8217;s green psycopg2 branch; see <a class="reference external" href="https://lists.secondlife.com/pipermail/eventletdev/2010-April/000800.html">the announcement</a> for more information.</p>
</dd></dl>
<dl class="function">
<dt id="eventlet.patcher.is_monkey_patched">
<tt class="descclassname">eventlet.patcher.</tt><tt class="descname">is_monkey_patched</tt><big>(</big><em>module</em><big>)</big><a class="headerlink" href="#eventlet.patcher.is_monkey_patched" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.patcher.</code><code class="descname">is_monkey_patched</code><span class="sig-paren">(</span><em>module</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.patcher.is_monkey_patched" title="Permalink to this definition"></a></dt>
<dd><p>Returns whether or not the specified module is currently monkeypatched. <em>module</em> can either be the module itself or the module&#8217;s name.</p>
<blockquote>
<div>Based entirely off the name of the module, so if you import a module some other way than with the import keyword (including <a class="reference internal" href="#eventlet.patcher.import_patched" title="eventlet.patcher.import_patched"><tt class="xref py py-func docutils literal"><span class="pre">import_patched()</span></tt></a>), is_monkey_patched might not be correct about that particular module.</div></blockquote>
<div>Based entirely off the name of the module, so if you import a module some other way than with the import keyword (including <a class="reference internal" href="#eventlet.patcher.import_patched" title="eventlet.patcher.import_patched"><code class="xref py py-func docutils literal"><span class="pre">import_patched()</span></code></a>), is_monkey_patched might not be correct about that particular module.</div></blockquote>
</dd></dl>
</div>
@ -124,7 +124,7 @@ library. This has the disadvantage of appearing quite magical, but the advantag
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
@ -141,12 +141,14 @@ library. This has the disadvantage of appearing quite magical, but the advantag
<h4>Next topic</h4>
<p class="topless"><a href="examples.html"
title="next chapter">Examples</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/patching.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/patching.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -163,7 +165,7 @@ library. This has the disadvantage of appearing quite magical, but the advantag
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -178,13 +180,13 @@ library. This has the disadvantage of appearing quite magical, but the advantag
<li class="right" >
<a href="design_patterns.html" title="Design Patterns"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Python Module Index &mdash; Eventlet 0.16.1 documentation</title>
<title>Python Module Index &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,13 +23,13 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -38,14 +38,14 @@
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<h1>Python Module Index</h1>
@ -63,72 +63,67 @@
<td><img src="_static/minus.png" class="toggler"
id="toggle-1" style="display: none" alt="-" /></td>
<td>
<tt class="xref">eventlet</tt></td><td>
<code class="xref">eventlet</code></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/backdoor.html#module-eventlet.backdoor"><tt class="xref">eventlet.backdoor</tt></a></td><td>
<a href="modules/backdoor.html#module-eventlet.backdoor"><code class="xref">eventlet.backdoor</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/corolocal.html#module-eventlet.corolocal"><tt class="xref">eventlet.corolocal</tt></a></td><td>
<a href="modules/corolocal.html#module-eventlet.corolocal"><code class="xref">eventlet.corolocal</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/db_pool.html#module-eventlet.db_pool"><tt class="xref">eventlet.db_pool</tt></a></td><td>
<a href="modules/db_pool.html#module-eventlet.db_pool"><code class="xref">eventlet.db_pool</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/debug.html#module-eventlet.debug"><tt class="xref">eventlet.debug</tt></a></td><td>
<a href="modules/debug.html#module-eventlet.debug"><code class="xref">eventlet.debug</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/event.html#module-eventlet.event"><tt class="xref">eventlet.event</tt></a></td><td>
<a href="modules/event.html#module-eventlet.event"><code class="xref">eventlet.event</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/zmq.html#module-eventlet.green.zmq"><tt class="xref">eventlet.green.zmq</tt></a></td><td>
<a href="modules/greenpool.html#module-eventlet.greenpool"><code class="xref">eventlet.greenpool</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/greenpool.html#module-eventlet.greenpool"><tt class="xref">eventlet.greenpool</tt></a></td><td>
<a href="modules/greenthread.html#module-eventlet.greenthread"><code class="xref">eventlet.greenthread</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/greenthread.html#module-eventlet.greenthread"><tt class="xref">eventlet.greenthread</tt></a></td><td>
<a href="modules/pools.html#module-eventlet.pools"><code class="xref">eventlet.pools</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/pools.html#module-eventlet.pools"><tt class="xref">eventlet.pools</tt></a></td><td>
<a href="modules/queue.html#module-eventlet.queue"><code class="xref">eventlet.queue</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/queue.html#module-eventlet.queue"><tt class="xref">eventlet.queue</tt></a></td><td>
<a href="threading.html#module-eventlet.tpool"><code class="xref">eventlet.tpool</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="threading.html#module-eventlet.tpool"><tt class="xref">eventlet.tpool</tt></a></td><td>
<a href="modules/websocket.html#module-eventlet.websocket"><code class="xref">eventlet.websocket</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/websocket.html#module-eventlet.websocket"><tt class="xref">eventlet.websocket</tt></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="modules/wsgi.html#module-eventlet.wsgi"><tt class="xref">eventlet.wsgi</tt></a></td><td>
<a href="modules/wsgi.html#module-eventlet.wsgi"><code class="xref">eventlet.wsgi</code></a></td><td>
<em></em></td></tr>
<tr class="pcap"><td></td><td>&nbsp;</td><td></td></tr>
<tr class="cap" id="cap-z"><td></td><td>
@ -136,7 +131,7 @@
<tr>
<td></td>
<td>
<a href="modules/zmq.html#module-zmq"><tt class="xref">zmq</tt></a></td><td>
<a href="modules/zmq.html#module-zmq"><code class="xref">zmq</code></a></td><td>
<em></em></td></tr>
</table>
@ -144,9 +139,9 @@
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -163,7 +158,7 @@
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -172,13 +167,13 @@
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search &mdash; Eventlet 0.16.1 documentation</title>
<title>Search &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/searchtools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<script type="text/javascript">
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
@ -33,8 +33,8 @@
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,14 +43,14 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<h1 id="search-documentation">Search</h1>
<div id="fallback" class="admonition warning">
@ -79,13 +79,13 @@
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -94,13 +94,13 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

File diff suppressed because one or more lines are too long

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Using SSL With Eventlet &mdash; Eventlet 0.16.1 documentation</title>
<title>Using SSL With Eventlet &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="Threads" href="threading.html" />
<link rel="prev" title="Examples" href="examples.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,19 +43,19 @@
<li class="right" >
<a href="examples.html" title="Examples"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="using-ssl-with-eventlet">
<h1>Using SSL With Eventlet<a class="headerlink" href="#using-ssl-with-eventlet" title="Permalink to this headline"></a></h1>
<p>Eventlet makes it easy to use non-blocking SSL sockets. If you&#8217;re using Python 2.6 or later, you&#8217;re all set, eventlet wraps the built-in ssl module. If on Python 2.5 or 2.4, you have to install <a class="reference external" href="https://launchpad.net/pyopenssl">pyOpenSSL</a> to use eventlet.</p>
<p>In either case, the the <tt class="docutils literal"><span class="pre">green</span></tt> modules handle SSL sockets transparently, just like their standard counterparts. As an example, <tt class="xref py py-mod docutils literal"><span class="pre">eventlet.green.urllib2</span></tt> can be used to fetch https urls in as non-blocking a fashion as you please:</p>
<p>In either case, the the <code class="docutils literal"><span class="pre">green</span></code> modules handle SSL sockets transparently, just like their standard counterparts. As an example, <code class="xref py py-mod docutils literal"><span class="pre">eventlet.green.urllib2</span></code> can be used to fetch https urls in as non-blocking a fashion as you please:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">eventlet.green</span> <span class="kn">import</span> <span class="n">urllib2</span>
<span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">spawn</span>
<span class="n">bodies</span> <span class="o">=</span> <span class="p">[</span><span class="n">spawn</span><span class="p">(</span><span class="n">urllib2</span><span class="o">.</span><span class="n">urlopen</span><span class="p">,</span> <span class="n">url</span><span class="p">)</span>
@ -66,16 +66,16 @@
</div>
<div class="section" id="with-python-2-6">
<h2>With Python 2.6<a class="headerlink" href="#with-python-2-6" title="Permalink to this headline"></a></h2>
<p>To use ssl sockets directly in Python 2.6, use <tt class="xref py py-mod docutils literal"><span class="pre">eventlet.green.ssl</span></tt>, which is a non-blocking wrapper around the standard Python <a class="reference external" href="http://docs.python.org/library/ssl.html#module-ssl" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">ssl</span></tt></a> module, and which has the same interface. See the standard documentation for instructions on use.</p>
<p>To use ssl sockets directly in Python 2.6, use <code class="xref py py-mod docutils literal"><span class="pre">eventlet.green.ssl</span></code>, which is a non-blocking wrapper around the standard Python <a class="reference external" href="http://docs.python.org/library/ssl.html#module-ssl" title="(in Python v2.7)"><code class="xref py py-mod docutils literal"><span class="pre">ssl</span></code></a> module, and which has the same interface. See the standard documentation for instructions on use.</p>
</div>
<div class="section" id="with-python-2-5-or-earlier">
<h2>With Python 2.5 or Earlier<a class="headerlink" href="#with-python-2-5-or-earlier" title="Permalink to this headline"></a></h2>
<p>Prior to Python 2.6, there is no <a class="reference external" href="http://docs.python.org/library/ssl.html#module-ssl" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">ssl</span></tt></a>, so SSL support is much weaker. Eventlet relies on pyOpenSSL to implement its SSL support on these older versions, so be sure to install pyOpenSSL, or you&#8217;ll get an ImportError whenever your system tries to make an SSL connection.</p>
<p>Once pyOpenSSL is installed, you can then use the <tt class="docutils literal"><span class="pre">eventlet.green</span></tt> modules, like <tt class="xref py py-mod docutils literal"><span class="pre">eventlet.green.httplib</span></tt> to fetch https urls. You can also use <tt class="xref py py-func docutils literal"><span class="pre">eventlet.green.socket.ssl()</span></tt>, which is a nonblocking wrapper for <tt class="xref py py-func docutils literal"><span class="pre">socket.ssl()</span></tt>.</p>
<p>Prior to Python 2.6, there is no <a class="reference external" href="http://docs.python.org/library/ssl.html#module-ssl" title="(in Python v2.7)"><code class="xref py py-mod docutils literal"><span class="pre">ssl</span></code></a>, so SSL support is much weaker. Eventlet relies on pyOpenSSL to implement its SSL support on these older versions, so be sure to install pyOpenSSL, or you&#8217;ll get an ImportError whenever your system tries to make an SSL connection.</p>
<p>Once pyOpenSSL is installed, you can then use the <code class="docutils literal"><span class="pre">eventlet.green</span></code> modules, like <code class="xref py py-mod docutils literal"><span class="pre">eventlet.green.httplib</span></code> to fetch https urls. You can also use <code class="xref py py-func docutils literal"><span class="pre">eventlet.green.socket.ssl()</span></code>, which is a nonblocking wrapper for <code class="xref py py-func docutils literal"><span class="pre">socket.ssl()</span></code>.</p>
</div>
<div class="section" id="pyopenssl">
<h2>PyOpenSSL<a class="headerlink" href="#pyopenssl" title="Permalink to this headline"></a></h2>
<p><tt class="xref py py-mod docutils literal"><span class="pre">eventlet.green.OpenSSL</span></tt> has exactly the same interface as <a class="reference external" href="https://launchpad.net/pyopenssl">pyOpenSSL</a> <a class="reference external" href="http://pyopenssl.sourceforge.net/pyOpenSSL.html/">(docs)</a>, and works in all versions of Python. This module is much more powerful than <tt class="xref py py-func docutils literal"><span class="pre">socket.ssl()</span></tt>, and may have some advantages over <a class="reference external" href="http://docs.python.org/library/ssl.html#module-ssl" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">ssl</span></tt></a>, depending on your needs.</p>
<p><code class="xref py py-mod docutils literal"><span class="pre">eventlet.green.OpenSSL</span></code> has exactly the same interface as <a class="reference external" href="https://launchpad.net/pyopenssl">pyOpenSSL</a> <a class="reference external" href="http://pyopenssl.sourceforge.net/pyOpenSSL.html/">(docs)</a>, and works in all versions of Python. This module is much more powerful than <code class="xref py py-func docutils literal"><span class="pre">socket.ssl()</span></code>, and may have some advantages over <a class="reference external" href="http://docs.python.org/library/ssl.html#module-ssl" title="(in Python v2.7)"><code class="xref py py-mod docutils literal"><span class="pre">ssl</span></code></a>, depending on your needs.</p>
<p>Here&#8217;s an example of a server:</p>
<div class="highlight-python"><div class="highlight"><pre>from eventlet.green import socket
from eventlet.green.OpenSSL import SSL
@ -108,7 +108,7 @@ connection.close()
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
@ -126,12 +126,14 @@ connection.close()
<h4>Next topic</h4>
<p class="topless"><a href="threading.html"
title="next chapter">Threads</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/ssl.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/ssl.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -148,7 +150,7 @@ connection.close()
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -163,13 +165,13 @@ connection.close()
<li class="right" >
<a href="examples.html" title="Examples"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Testing Eventlet &mdash; Eventlet 0.16.1 documentation</title>
<title>Testing Eventlet &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="Environment Variables" href="environment.html" />
<link rel="prev" title="Understanding Eventlet Hubs" href="hubs.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,14 +43,14 @@
<li class="right" >
<a href="hubs.html" title="Understanding Eventlet Hubs"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="testing-eventlet">
<h1>Testing Eventlet<a class="headerlink" href="#testing-eventlet" title="Permalink to this headline"></a></h1>
@ -88,11 +88,11 @@
</div>
<div class="section" id="testing-eventlet-hubs">
<h2>Testing Eventlet Hubs<a class="headerlink" href="#testing-eventlet-hubs" title="Permalink to this headline"></a></h2>
<p>When you run the tests, Eventlet will use the most appropriate hub for the current platform to do its dispatch. It&#8217;s sometimes useful when making changes to Eventlet to test those changes on hubs other than the default. You can do this with the <tt class="docutils literal"><span class="pre">EVENTLET_HUB</span></tt> environment variable.</p>
<p>When you run the tests, Eventlet will use the most appropriate hub for the current platform to do its dispatch. It&#8217;s sometimes useful when making changes to Eventlet to test those changes on hubs other than the default. You can do this with the <code class="docutils literal"><span class="pre">EVENTLET_HUB</span></code> environment variable.</p>
<div class="highlight-sh"><div class="highlight"><pre><span class="nv">$ EVENTLET_HUB</span><span class="o">=</span>epolls nosetests
</pre></div>
</div>
<p>See <a class="reference internal" href="hubs.html#understanding-hubs"><em>Understanding Eventlet Hubs</em></a> for the full list of hubs.</p>
<p>See <a class="reference internal" href="hubs.html#understanding-hubs"><span>Understanding Eventlet Hubs</span></a> for the full list of hubs.</p>
</div>
<div class="section" id="writing-tests">
<h2>Writing Tests<a class="headerlink" href="#writing-tests" title="Permalink to this headline"></a></h2>
@ -110,12 +110,12 @@
<div class="highlight-sh"><div class="highlight"><pre>nosetests --with-coverage --cover-package<span class="o">=</span>eventlet
</pre></div>
</div>
<p>After running the tests to completion, this will emit a huge wodge of module names and line numbers. For some reason, the <tt class="docutils literal"><span class="pre">--cover-inclusive</span></tt> option breaks everything rather than serving its purpose of limiting the coverage to the local files, so don&#8217;t use that.</p>
<p>After running the tests to completion, this will emit a huge wodge of module names and line numbers. For some reason, the <code class="docutils literal"><span class="pre">--cover-inclusive</span></code> option breaks everything rather than serving its purpose of limiting the coverage to the local files, so don&#8217;t use that.</p>
<p>The html option is quite useful because it generates nicely-formatted HTML that are much easier to read than line-number soup. Here&#8217;s a command that generates the annotation, dumping the html files into a directory called &#8220;cover&#8221;:</p>
<div class="highlight-sh"><div class="highlight"><pre>coverage html -d cover --omit<span class="o">=</span><span class="s1">&#39;tempmod,&lt;console&gt;,tests&#39;</span>
</pre></div>
</div>
<p>(<tt class="docutils literal"><span class="pre">tempmod</span></tt> and <tt class="docutils literal"><span class="pre">console</span></tt> are omitted because they gets thrown away at the completion of their unit tests and coverage.py isn&#8217;t smart enough to detect this.)</p>
<p>(<code class="docutils literal"><span class="pre">tempmod</span></code> and <code class="docutils literal"><span class="pre">console</span></code> are omitted because they gets thrown away at the completion of their unit tests and coverage.py isn&#8217;t smart enough to detect this.)</p>
</div>
</div>
@ -123,7 +123,7 @@
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
@ -143,12 +143,14 @@
<h4>Next topic</h4>
<p class="topless"><a href="environment.html"
title="next chapter">Environment Variables</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/testing.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/testing.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -165,7 +167,7 @@
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -180,13 +182,13 @@
<li class="right" >
<a href="hubs.html" title="Understanding Eventlet Hubs"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Threads &mdash; Eventlet 0.16.1 documentation</title>
<title>Threads &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="Zeromq" href="zeromq.html" />
<link rel="prev" title="Using SSL With Eventlet" href="ssl.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,25 +43,25 @@
<li class="right" >
<a href="ssl.html" title="Using SSL With Eventlet"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="threads">
<h1>Threads<a class="headerlink" href="#threads" title="Permalink to this headline"></a></h1>
<p>Eventlet is thread-safe and can be used in conjunction with normal Python threads. The way this works is that coroutines are confined to their &#8216;parent&#8217; Python thread. It&#8217;s like each thread contains its own little world of coroutines that can switch between themselves but not between coroutines in other threads.</p>
<img alt="_images/threading_illustration.png" src="_images/threading_illustration.png" />
<p>You can only communicate cross-thread using the &#8220;real&#8221; thread primitives and pipes. Fortunately, there&#8217;s little reason to use threads for concurrency when you&#8217;re already using coroutines.</p>
<p>The vast majority of the times you&#8217;ll want to use threads are to wrap some operation that is not &#8220;green&#8221;, such as a C library that uses its own OS calls to do socket operations. The <a class="reference internal" href="#module-eventlet.tpool" title="eventlet.tpool"><tt class="xref py py-mod docutils literal"><span class="pre">tpool</span></tt></a> module is provided to make these uses simpler.</p>
<p>The optional <a class="reference internal" href="hubs.html#understanding-hubs"><em>pyevent hub</em></a> is not compatible with threads.</p>
<p>The vast majority of the times you&#8217;ll want to use threads are to wrap some operation that is not &#8220;green&#8221;, such as a C library that uses its own OS calls to do socket operations. The <a class="reference internal" href="#module-eventlet.tpool" title="eventlet.tpool"><code class="xref py py-mod docutils literal"><span class="pre">tpool</span></code></a> module is provided to make these uses simpler.</p>
<p>The optional <a class="reference internal" href="hubs.html#understanding-hubs"><span>pyevent hub</span></a> is not compatible with threads.</p>
<div class="section" id="tpool-simple-thread-pool">
<h2>Tpool - Simple thread pool<a class="headerlink" href="#tpool-simple-thread-pool" title="Permalink to this headline"></a></h2>
<p>The simplest thing to do with <a class="reference internal" href="#module-eventlet.tpool" title="eventlet.tpool"><tt class="xref py py-mod docutils literal"><span class="pre">tpool</span></tt></a> is to <a class="reference internal" href="#eventlet.tpool.execute" title="eventlet.tpool.execute"><tt class="xref py py-func docutils literal"><span class="pre">execute()</span></tt></a> a function with it. The function will be run in a random thread in the pool, while the calling coroutine blocks on its completion:</p>
<p>The simplest thing to do with <a class="reference internal" href="#module-eventlet.tpool" title="eventlet.tpool"><code class="xref py py-mod docutils literal"><span class="pre">tpool</span></code></a> is to <a class="reference internal" href="#eventlet.tpool.execute" title="eventlet.tpool.execute"><code class="xref py py-func docutils literal"><span class="pre">execute()</span></code></a> a function with it. The function will be run in a random thread in the pool, while the calling coroutine blocks on its completion:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">thread</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">eventlet</span> <span class="kn">import</span> <span class="n">tpool</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">my_func</span><span class="p">(</span><span class="n">starting_ident</span><span class="p">):</span>
@ -71,10 +71,10 @@
<span class="go">running in new thread: True</span>
</pre></div>
</div>
<p>By default there are 20 threads in the pool, but you can configure this by setting the environment variable <tt class="docutils literal"><span class="pre">EVENTLET_THREADPOOL_SIZE</span></tt> to the desired pool size before importing tpool.</p>
<p>By default there are 20 threads in the pool, but you can configure this by setting the environment variable <code class="docutils literal"><span class="pre">EVENTLET_THREADPOOL_SIZE</span></code> to the desired pool size before importing tpool.</p>
<span class="target" id="module-eventlet.tpool"></span><dl class="function">
<dt id="eventlet.tpool.execute">
<tt class="descclassname">eventlet.tpool.</tt><tt class="descname">execute</tt><big>(</big><em>meth</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#eventlet.tpool.execute" title="Permalink to this definition"></a></dt>
<code class="descclassname">eventlet.tpool.</code><code class="descname">execute</code><span class="sig-paren">(</span><em>meth</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.tpool.execute" title="Permalink to this definition"></a></dt>
<dd><p>Execute <em>meth</em> in a Python thread, blocking the current coroutine/
greenthread until the method completes.</p>
<p>The primary use case for this is to wrap an object or module that is not
@ -86,7 +86,7 @@ of some overhead.</p>
<dl class="class">
<dt id="eventlet.tpool.Proxy">
<em class="property">class </em><tt class="descclassname">eventlet.tpool.</tt><tt class="descname">Proxy</tt><big>(</big><em>obj</em>, <em>autowrap=()</em>, <em>autowrap_names=()</em><big>)</big><a class="headerlink" href="#eventlet.tpool.Proxy" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">eventlet.tpool.</code><code class="descname">Proxy</code><span class="sig-paren">(</span><em>obj</em>, <em>autowrap=()</em>, <em>autowrap_names=()</em><span class="sig-paren">)</span><a class="headerlink" href="#eventlet.tpool.Proxy" title="Permalink to this definition"></a></dt>
<dd><p>a simple proxy-wrapper of any object that comes with a
methods-only interface, in order to forward every method
invocation onto a thread in the native-thread pool. A key
@ -113,7 +113,7 @@ wrapped in Proxy objects when accessed.</p>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
@ -129,12 +129,14 @@ wrapped in Proxy objects when accessed.</p>
<h4>Next topic</h4>
<p class="topless"><a href="zeromq.html"
title="next chapter">Zeromq</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/threading.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/threading.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -151,7 +153,7 @@ wrapped in Proxy objects when accessed.</p>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -166,13 +168,13 @@ wrapped in Proxy objects when accessed.</p>
<li class="right" >
<a href="ssl.html" title="Using SSL With Eventlet"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Zeromq &mdash; Eventlet 0.16.1 documentation</title>
<title>Zeromq &mdash; Eventlet 0.17.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.16.1',
VERSION: '0.17.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -23,12 +23,12 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Eventlet 0.16.1 documentation" href="index.html" />
<link rel="top" title="Eventlet 0.17.2 documentation" href="index.html" />
<link rel="next" title="Understanding Eventlet Hubs" href="hubs.html" />
<link rel="prev" title="Threads" href="threading.html" />
</head>
<body>
<div class="related">
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -43,14 +43,14 @@
<li class="right" >
<a href="threading.html" title="Threads"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="body" role="main">
<div class="section" id="zeromq">
<h1>Zeromq<a class="headerlink" href="#zeromq" title="Permalink to this headline"></a></h1>
@ -74,7 +74,7 @@ while simultaneously accepting incoming connections from multiple endpoints boun
</div>
<div class="section" id="api-documentation">
<h2>API documentation<a class="headerlink" href="#api-documentation" title="Permalink to this headline"></a></h2>
<p>ØMQ support is provided in the <a class="reference internal" href="modules/zmq.html#module-eventlet.green.zmq" title="eventlet.green.zmq"><tt class="xref py py-mod docutils literal"><span class="pre">eventlet.green.zmq</span></tt></a> module</p>
<p>ØMQ support is provided in the <code class="xref py py-mod docutils literal"><span class="pre">eventlet.green.zmq</span></code> module</p>
</div>
</div>
@ -82,7 +82,7 @@ while simultaneously accepting incoming connections from multiple endpoints boun
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
@ -99,12 +99,14 @@ while simultaneously accepting incoming connections from multiple endpoints boun
<h4>Next topic</h4>
<p class="topless"><a href="hubs.html"
title="next chapter">Understanding Eventlet Hubs</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/zeromq.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/zeromq.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
@ -121,7 +123,7 @@ while simultaneously accepting incoming connections from multiple endpoints boun
</div>
<div class="clearer"></div>
</div>
<div class="related">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
@ -136,13 +138,13 @@ while simultaneously accepting incoming connections from multiple endpoints boun
<li class="right" >
<a href="threading.html" title="Threads"
>previous</a> |</li>
<li><a href="index.html">Eventlet 0.16.1 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html">Eventlet 0.17.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
<div class="footer" role="contentinfo">
&copy; Copyright 2005-2010, Eventlet Contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -54,7 +54,7 @@ pip install eventlet
<p>Alternately, you can download the source tarball:</p>
<ul>
<li>latest release from <a class="reference external" target="_blank" href="https://pypi.python.org/pypi/eventlet/">PyPi</a>:
<a class="reference external" href="https://pypi.python.org/packages/source/e/eventlet/eventlet-0.16.1.tar.gz">eventlet-0.16.1.tar.gz</a></li>
<a class="reference external" href="https://pypi.python.org/packages/source/e/eventlet/eventlet-0.17.2.tar.gz">eventlet-0.17.2.tar.gz</a></li>
<li>or <a class="reference external" href="https://github.com/eventlet/eventlet/archive/master.zip">latest development version</a></li>
</ul>
@ -74,11 +74,12 @@ pip install eventlet
<h3>Development</h3>
<ul>
<li><a class="reference external" target="_blank" href="https://bitbucket.org/eventlet/eventlet/">Mercurial on Bitbucket</a></li>
<li><a class="reference external" target="_blank" href="https://github.com/eventlet/eventlet/">Official Github mirror</a></li>
<li><a class="reference" target="_blank" href="https://github.com/eventlet/eventlet/">Eventlet on Github</a></li>
<li><a class="reference external" target="_blank" href="https://bitbucket.org/eventlet/eventlet/">Mercurial on Bitbucket</a>, "eventually consistent" mirror.</li>
</ul>
<p>Both repositories are equal and kept in sync.
You can use whichever you fancy for downloading, forking, reporting issues and submitting pull requests.</p>
<p>Mercurial repository used to be the main one, but most of the contribution and discussions happen on Github nowadays.</p>
<h4>Pull request policy</h4>
<ul>