MCPcopy Index your code
hub / github.com/ipython/ipython / gilsleep

Function gilsleep

tools/tests/heartbeat/hb_gil.py:20–29  ·  view source on GitHub ↗

gil-holding sleep with cython.inline

(t)

Source from the content-addressed store, hash-verified

18from cython import inline
19
20def gilsleep(t):
21 """gil-holding sleep with cython.inline"""
22 code = '\n'.join([
23 'from posix cimport unistd',
24 'unistd.sleep(t)',
25 ])
26 while True:
27 inline(code, quiet=True, t=t)
28 print(time.time())
29 sys.stdout.flush() # this is important
30
31gilsleep(5)

Callers 1

hb_gil.pyFile · 0.85

Calls 2

timeMethod · 0.80
flushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…