Non-Blocking Pipe
Project description
Non-Blocking-Multiprocessing-Pipe
Non blocking multiprocessing pipe implemented in Python asyncio
Installing
pip install pipe_nonblock
Supported versions
- Python 3.4+
Usage
from pipe_nonblock import Pipe
c1, c2 = Pipe(duplex=True, conn1_nonblock=True, conn2_nonblock=True) # create a new duplex non-blocking pipe
assert len(list(c2.recv(32))) == 0 # try receive data from a connection, it's empty at the moment
c1.send('foo') # send python string object
buf, = c2.recv(32) # recv return generator with received objects
assert buf == 'foo'
c2.send('bar')
buf, = c1.recv(32)
assert buf == 'bar'
Overview of Pipe function
def Pipe(duplex, conn1_nonblock, conn1_nonblock) -> Tuple[connection1, connection2]:
parameter | type | description |
---|---|---|
duplex | bool | If duplex is True (the default) then the pipe is bidirectional. If duplex is False then the pipe is unidirectional: conn1 can only be used for receiving messages and conn2 can only be used for sending messages. |
conn1_nonblock | bool | If conn1_nonblock is True then the connection1 is non-blocking |
conn2_nonblock | bool | If conn2_nonblock is True then the connection2 is non-blocking |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pipe_nonblock-0.1.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for pipe_nonblock-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de5600653418781dc68c19f61e39bdc5642906cd98e62fd2143a8901bda17fa3 |
|
MD5 | 3189cea3c285f0e19ca824d4c29a86eb |
|
BLAKE2b-256 | 2caee555c597ec2205502cab28be8ed280182111aa5ea5eef6c08be95fd77fb4 |