summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraspect <aspect+tclcore@abstracted-spleen.org>2017-01-04 23:09:21 (GMT)
committeraspect <aspect+tclcore@abstracted-spleen.org>2017-01-04 23:09:21 (GMT)
commitc0d9d96afae4768f94947e880efcc18fdfcd8c72 (patch)
tree3d0fd16c9218e78d12adc3331f6a0a49a7aa8c04
parent6a959aa18c6bf30a5353bbead3e722d66f3bd350 (diff)
downloadtcl-aspect_async_pipe.zip
tcl-aspect_async_pipe.tar.gz
tcl-aspect_async_pipe.tar.bz2
don't panic when EAGAIN - if the pipe is full, we have to drop the messageaspect_async_pipe
-rw-r--r--generic/tclAsync.c10
1 files 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;
}
}