summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/cygthread.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-10-21 01:00:58 +0000
committerChristopher Faylor <me@cgf.cx>2002-10-21 01:00:58 +0000
commit5ec14fe40ae1a6b11d27b975feca1b20de435467 (patch)
tree568cd69f0dca513973fc6e6646fe6ea4b3b9dafe /winsup/cygwin/cygthread.cc
parentccefaab1d5735466b54f8c5dd279a310d6020a77 (diff)
downloadcygnal-5ec14fe40ae1a6b11d27b975feca1b20de435467.tar.gz
cygnal-5ec14fe40ae1a6b11d27b975feca1b20de435467.tar.bz2
cygnal-5ec14fe40ae1a6b11d27b975feca1b20de435467.zip
Change _function() to function() throughout.
* cygwin.din: Remove last vestiges (?) of newlib wrappers. * cygthread.cc (cygthread::detach): Always wait for event or suffer an apparently inavoidable race. * dcrt0.cc (dll_crt0_1): Allocate threads after stack has been relocated. * debub.cc (lock_debug): Don't acquire lock on exit. * fork.cc (fork_child): Recreate mmaps before doing anything else since Windows has a habit of using blocks of memory in the child that could previously have been occupied by shared memory in the parent. * mmap.cc (fhandler_disk_file::fixup_mmap_after_fork): Issue error here and provide some details about what went wrong. (fixup_mmaps_after_fork): Remove error message. * shared.cc (open_shared): Move warning message so that more detail is possible. * sigproc.cc (sigproc_init): Initialize sync_proc_subproc to avoid a race. (sigproc_terminate): Specifically wait for process thread to terminate.
Diffstat (limited to 'winsup/cygwin/cygthread.cc')
-rw-r--r--winsup/cygwin/cygthread.cc22
1 files changed, 7 insertions, 15 deletions
diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc
index e564ad3d0..7143d70bb 100644
--- a/winsup/cygwin/cygthread.cc
+++ b/winsup/cygwin/cygthread.cc
@@ -64,7 +64,6 @@ cygthread::stub (VOID *arg)
switch (WaitForSingleObject (info->thread_sync, INFINITE))
{
case WAIT_OBJECT_0:
- // ResetEvent (info->thread_sync);
continue;
default:
api_fatal ("WFSO failed, %E");
@@ -204,10 +203,10 @@ cygthread::cygthread (LPTHREAD_START_ROUTINE start, LPVOID param,
__name = name; /* Need to set after thread has woken up to
ensure that it won't be cleared by exiting
thread. */
- if (thread_sync)
- SetEvent (thread_sync);
- else
+ if (!thread_sync)
ResumeThread (h);
+ else
+ SetEvent (thread_sync);
}
/* Return the symbolic name of the current thread for debugging.
@@ -269,15 +268,9 @@ cygthread::detach ()
else
{
DWORD avail = id;
- /* Checking for __name here is just a minor optimization to avoid
- an OS call. */
- if (!__name)
- thread_printf ("thread id %p returned. No need to wait.", id);
- else
- {
- DWORD res = WaitForSingleObject (*this, INFINITE);
- thread_printf ("WFSO returns %d, id %p", res, id);
- }
+ DWORD res = WaitForSingleObject (*this, INFINITE);
+ thread_printf ("WFSO returns %d, id %p", res, id);
+
if (is_freerange)
{
CloseHandle (h);
@@ -285,9 +278,8 @@ cygthread::detach ()
}
else
{
- ResetEvent (*this);
id = 0;
- __name = NULL;
+ ResetEvent (*this);
/* Mark the thread as available by setting avail to non-zero */
(void) InterlockedExchange ((LPLONG) &this->avail, avail);
}