Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dc70029b910f
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 18efca0f0a36
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Mar 1, 2016

  1. Copy the full SHA
    b0526c3 View commit details
  2. Copy the full SHA
    18efca0 View commit details
Showing with 10 additions and 6 deletions.
  1. +10 −6 artiq/protocols/pipe_ipc.py
16 changes: 10 additions & 6 deletions artiq/protocols/pipe_ipc.py
Original file line number Diff line number Diff line change
@@ -109,7 +109,6 @@ def __init__(self):
# mode or not.
self.address = "\\\\.\\pipe\\artiq-{}-{}".format(os.getpid(),
next(_pipe_count))
self.server = None
self.ready = asyncio.Event()
self.write_buffer = b""

@@ -118,11 +117,12 @@ def get_address(self):

async def _autoclose(self):
await self.process.wait()
if self.server is not None:
self.server[0].close()
self.server = None
self.server[0].close()
del self.server
if self.ready.is_set():
self.writer.close()
del self.reader
del self.writer

async def create_subprocess(self, *args, **kwargs):
loop = asyncio.get_event_loop()
@@ -150,8 +150,12 @@ def _child_connected(self, reader, writer):
# There is still a race condition in the AsyncioParentComm
# creation/destruction, but it is unlikely to cause problems
# in most practical cases.
assert self.server is not None
self.server = None
if self.ready.is_set():
# A child already connected before. We should have shut down
# the server, but asyncio won't let us do that.
# Drop connections immediately instead.
writer.close()
return
self.reader = reader
self.writer = writer
if self.write_buffer: