[uim-commit] r611 - trunk/uim
ekato at freedesktop.org
ekato at freedesktop.org
Tue Feb 8 02:37:23 PST 2005
Author: ekato
Date: 2005-02-08 02:37:18 -0800 (Tue, 08 Feb 2005)
New Revision: 611
Modified:
trunk/uim/uim-helper.c
Log:
* uim/uim-helper.c (uim_helper_send_message) : Update sleep code.
Modified: trunk/uim/uim-helper.c
===================================================================
--- trunk/uim/uim-helper.c 2005-02-08 09:33:46 UTC (rev 610)
+++ trunk/uim/uim-helper.c 2005-02-08 10:37:18 UTC (rev 611)
@@ -129,10 +129,19 @@
while (out_len > 0) {
if ((res = write(fd, bufp, out_len)) < 0) {
if (errno == EAGAIN || errno == EINTR) {
- //while (uim_helper_fd_writable(fd) == 0) {
- usleep((rand() % getpid()) * 10);
- //}
- continue;
+ fd_set fds;
+ struct timeval tv;
+ int rc;
+
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100000;
+ rc = select(fd + 1, NULL, &fds, NULL, &tv);
+ if (rc > 0 && FD_ISSET(fd, &fds)) {
+ continue;
+ }
+ fprintf(stderr, "uim_helper_send_message: write failed\n");
}
break;
}
More information about the Uim-commit
mailing list