##// END OF EJS Templates
don't build sphinx docs for sdist
don't build sphinx docs for sdist

File last commit:

r5885:cf991e07
r6145:5591758e
Show More
gilsleep.ipynb
55 lines | 1.3 KiB | text/plain | TextLexer
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 {
"metadata": {
"name": "gilsleep"
},
"nbformat": 2,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"source": [
"Holding the GIL for too long could disrupt the heartbeat due to non-copying sends.",
"",
"The following cell repeatedly calls a function that holds the GIL for five seconds.",
"",
"The heartbeat will fail after a few iterations prior to fixing Issue [#1260](https://github.com/ipython/ipython/issues/1260)."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import sys",
"import time",
"",
"from cython import inline",
"",
"def gilsleep(t):",
" \"\"\"gil-holding sleep with cython.inline\"\"\"",
" code = '\\n'.join([",
" 'from posix cimport unistd',",
" 'unistd.sleep(t)',",
" ])",
" while True:",
" inline(code, quiet=True, t=t)",
" print time.time()",
" sys.stdout.flush() # this is important",
"",
"gilsleep(5)"
],
"language": "python",
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": true,
"input": [],
"language": "python",
"outputs": [],
"prompt_number": " "
}
]
}
]
}