##// END OF EJS Templates
Bump codecov/codecov-action from 4 to 5 in the actions group (#14593)...
Bump codecov/codecov-action from 4 to 5 in the actions group (#14593) Bumps the actions group with 1 update: https://github.com/codecov/codecov-action

File last commit:

r28756:0ec1c212
r28979:86a74d8e merge
Show More
gilsleep.ipynb
72 lines | 1.6 KiB | text/plain | TextLexer

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.

In [1]:
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)
In [ ]: