search for: pysleep

Displaying 3 results from an estimated 3 matches for "pysleep".

Did you mean: psleep
2020 Aug 05
0
[PATCH nbdkit 4/4] python: Test the parallel thread model.
...CLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# Python plugin which uses the parallel thread model. Note that the +# cpython implementation of time.sleep releases the GIL (see +# Modules/timemodule.c:pysleep) + +import nbdkit +import time + +def thread_model(): + return nbdkit.THREAD_MODEL_PARALLEL + +def open(readonly): + return {} + +def get_size(h): + return 512 + +def pread(h, count, offset): + time.sleep(10) + return bytearray(count) -- 2.27.0
2020 Aug 05
5
[PATCH NOT WORKING nbdkit 0/3] python: Allow thread model to be set from Python plugins.
...er (data=0x9ee9cb0) at connections.c:116 #8 0x00007fc4b9d293f9 in start_thread () from /lib64/libpthread.so.0 #9 0x00007fc4b9c55b23 in clone () from /lib64/libc.so.6 Thread 4 (Thread 0x7fc4ab221640 (LWP 109868)): #0 0x00007fc4b9c4d1bb in select () from /lib64/libc.so.6 #1 0x00007fc4b95321e9 in pysleep (secs=<optimized out>) at /usr/src/debug/python3.9-3.9.0~b3-1.fc33.x86_64/Modules/timemodule.c:1909 #2 time_sleep (self=<optimized out>, obj=<optimized out>) at /usr/src/debug/python3.9-3.9.0~b3-1.fc33.x86_64/Modules/timemodule.c:341 #3 0x00007fc4b9451a62 in cfunction_vectorcall...
2020 Aug 05
5
[PATCH nbdkit 3/4] python: Allow thread model to be set from Python plugins.
This is working for me now, although possibly only on Python 3.9. Dan suggested PyEval_InitThreads but that was deprecated in Python 3.7. Rich.