solve #482012 but makes it more obvious what is going wrong if the pipe
fills up.
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@132
64e312b2-a51f-0410-8e61-
82d0ca0eb02a
*/
#include <sys/types.h>
-#include "unistd.h"
-#include "stdlib.h"
-#include "stdio.h"
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <stdio.h>
#include "list.h"
#include "check_error.h"
#include "check.h"
{
int fd[2];
- pipe(fd);
+ pipe (fd);
+
p->sendfd = fd[1];
p->recvfd = fd[0];
+
+ /*
+ * Make the pipe nonblocking so we don't block when too many
+ * messages are sent while the other end of the pipe waits for the
+ * test to exit (see bug #482012). This doesn't solve our problem,
+ * but it makes it more obvious what is happening since instead of
+ * blocking the test exits with "Resource temporarily unavailable".
+ */
+ fcntl (p->sendfd, F_SETFL, O_NONBLOCK);
}
-
+
void setup_messaging_with_key (MsgKey *key)
{
PipeEntry *pe;