From c0d9d96afae4768f94947e880efcc18fdfcd8c72 Mon Sep 17 00:00:00 2001 From: aspect Date: Wed, 4 Jan 2017 23:09:21 +0000 Subject: don't panic when EAGAIN - if the pipe is full, we have to drop the message --- generic/tclAsync.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/generic/tclAsync.c b/generic/tclAsync.c index 5116cbd..f219078 100644 --- a/generic/tclAsync.c +++ b/generic/tclAsync.c @@ -531,9 +531,15 @@ Tcl_AsyncMark( packet.token = (AsyncHandler *) token; rc = TclChanWrite(sharedData.writeChan, (char *) &packet, sizeof(packet)); - if (rc != sizeof(packet)) { + /* + * If write fails because the channel is full, simply drop the message. + * Something has to give under signal handler constraints! + * FIXME: windows? + */ + if (rc == -1 && Tcl_GetErrno() == EAGAIN) { + DEBUG("Got EAGAIN - dropping packet!"); + } else if (rc != sizeof(packet)) { Tcl_Panic("Tcl_AsyncMark: write error or short write to async pipe rc = %d[%d], errno = %d", rc, sizeof(packet), errno); - return; } } -- cgit v0.12