Make C module compatible with gevent at runtime.
Project description
greenify can make Python extension modules having network operations in C code to be compatible with gevent.
greenify uses the Dynamic Function Redirecting technique same as ELF-Hook to patch blocking network operations at runtime, without the need modify the original modules.
Currently greenify only supports ELF format modules, and is tested on Linux.
Build status
Install from source
greenify module is installed using setuptools or pip:
python setup.py install
or:
pip install greenify
Usage
Thread Safety
Once activated, the green C functions will, on potentially blocking operation, pass control to gevent’s main event loop, which may switch to other ready greenlet which is also in one of the green functions. So, make sure your C code can handle this kind of execution pause and resume. A thread safe program usually is ready for greenify, but remember that all the switches happen in a single thread.
License
greenify is written and maintained by douban and is licensed under New BSD license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for greenify-0.3.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc55192dd2eaa8e4ec780874dd54cf644df3f64c6070494b3bdd2af459e7d319 |
|
MD5 | cb0429c790085e01e8dd3b57fd539f67 |
|
BLAKE2b-256 | 1185d4b034ff482c80ad6d3af28966e8d79ad96f082cfe2d821581f0c69260d2 |
Hashes for greenify-0.3.2-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 116c4545b20b95efa7445815a5946abfdc249bd023dd7d014b220faeada16210 |
|
MD5 | 21dbb49158fcf15532ca6881d0d36c4d |
|
BLAKE2b-256 | 71e7d3fb411a9a6864865d0e3ef1ee236950bd7d91a83a841ca4130641f5cd4a |
Hashes for greenify-0.3.2-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ef7bf49ea9d31897839f13cecb9473ac88bf040c6432d25f41da42c7fd40382 |
|
MD5 | 97d54e5bf0023e528025298a305ca548 |
|
BLAKE2b-256 | 949660b1904ed211e1b37b1b58bf4e22cc6e709609c4374aec15095e9bf1836c |