summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-02-06 05:04:34 +0000
committerChristopher Faylor <me@cgf.cx>2005-02-06 05:04:34 +0000
commit85a798d6e755f4db4c04d92ecde1e5409a62cd59 (patch)
treef1b1eda0a4f9cdc38c11cd774e5db3e42f1de9cf /winsup/cygwin/fhandler.cc
parent901b1fb9852e5ccaa66ad82c539447394727f33c (diff)
downloadcygnal-85a798d6e755f4db4c04d92ecde1e5409a62cd59.tar.gz
cygnal-85a798d6e755f4db4c04d92ecde1e5409a62cd59.tar.bz2
cygnal-85a798d6e755f4db4c04d92ecde1e5409a62cd59.zip
* cygthread.h (cygthread::terminate_thread): Reflect return value.
* cygthread.cc (cygthread::detach): Be more careful about ensuring that sigwait is properly waited for to avoid later missynchronization. (cygthread::terminate_thread): Return true if thread was actually terminated and all handles were closed. * fhandler_base.cc (fhandler_base::raw_read): Use signal_read_state rather than raw calls to win32 api. (fhandler_base::read): Ditto. * fhandler.h (fhandler_pipe::fixup_after_exec): Use method to create read_state signalling. (fhandler_pipe::create): Ditto. * Makefile.in: Make some more files -fomit-frame-pointer.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index aa996ea56..1a18b7550 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -231,14 +231,9 @@ fhandler_base::raw_read (void *ptr, size_t& ulen)
h = GetCurrentThread ();
prio = GetThreadPriority (h);
(void) SetThreadPriority (h, THREAD_PRIORITY_TIME_CRITICAL);
- SetEvent (read_state);
+ signal_read_state (1);
}
BOOL res = ReadFile (get_handle (), ptr, len, (DWORD *) &ulen, 0);
- if (read_state)
- {
- SetEvent (read_state);
- (void) SetThreadPriority (h, prio);
- }
if (!res)
{
/* Some errors are not really errors. Detect such cases here. */
@@ -275,6 +270,11 @@ fhandler_base::raw_read (void *ptr, size_t& ulen)
break;
}
}
+ if (read_state)
+ {
+ signal_read_state (1);
+ (void) SetThreadPriority (h, prio);
+ }
#undef bytes_read
}
@@ -705,8 +705,8 @@ fhandler_base::read (void *in_ptr, size_t& len)
goto out;
}
- raw_read (ptr + copied_chars, len);
need_signal = false;
+ raw_read (ptr + copied_chars, len);
if (!copied_chars)
/* nothing */;
else if ((ssize_t) len > 0)
@@ -775,7 +775,7 @@ fhandler_base::read (void *in_ptr, size_t& len)
out:
if (need_signal)
- SetEvent (read_state);
+ signal_read_state (2);
debug_printf ("returning %d, %s mode", len, rbinary () ? "binary" : "text");
return;