Revert much of previous erroneous checkin. Add ChangeLog entry.
* pinfo.h: Correctly set __SIGOFFSET. * path.cc (hash_path_name): Avoid calling library functions for simple copying of characters. * shortcut.c: Use WIN32_LEAN_AND_MEAN. * smallprint.c: Ditto. * environ.cc (getwinenv): Minor clarity fix. * localtime.c: No need to include windows.h * string.h: New file.
This commit is contained in:
parent
17743fbc49
commit
63b61cd19f
@ -1,3 +1,19 @@
|
|||||||
|
Fri May 4 16:49:34 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* pinfo.h: Correctly set __SIGOFFSET.
|
||||||
|
|
||||||
|
* path.cc (hash_path_name): Avoid calling library functions for simple
|
||||||
|
copying of characters.
|
||||||
|
|
||||||
|
* shortcut.c: Use WIN32_LEAN_AND_MEAN.
|
||||||
|
* smallprint.c: Ditto.
|
||||||
|
|
||||||
|
* environ.cc (getwinenv): Minor clarity fix.
|
||||||
|
|
||||||
|
* localtime.c: No need to include windows.h
|
||||||
|
|
||||||
|
* string.h: New file.
|
||||||
|
|
||||||
Fri May 4 16:37:30 2001 Christopher Faylor <cgf@cygnus.com>
|
Fri May 4 16:37:30 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* exceptions.cc (ctrl_c_handler): Always send signal to process if it
|
* exceptions.cc (ctrl_c_handler): Always send signal to process if it
|
||||||
|
@ -70,9 +70,9 @@ std_dll_init (HANDLE &dll_handle, const char *dll_name, LONG &here)
|
|||||||
{
|
{
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
|
|
||||||
while (ilockincr (&here))
|
while (InterlockedIncrement (&here))
|
||||||
{
|
{
|
||||||
ilockdecr (&here);
|
InterlockedDecrement (&here);
|
||||||
Sleep (0);
|
Sleep (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ std_dll_init (HANDLE &dll_handle, const char *dll_name, LONG &here)
|
|||||||
else
|
else
|
||||||
api_fatal ("could not load %s, %E", dll_name);
|
api_fatal ("could not load %s, %E", dll_name);
|
||||||
|
|
||||||
ilockdecr (&here);
|
InterlockedDecrement (&here);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ thread_stub (VOID *arg)
|
|||||||
exception_list except_entry;
|
exception_list except_entry;
|
||||||
|
|
||||||
/* Give up our slot in the start_buf array */
|
/* Give up our slot in the start_buf array */
|
||||||
(void) ilockexch (&((thread_start *) arg)->notavail, 0);
|
(void) InterlockedExchange (&((thread_start *) arg)->notavail, 0);
|
||||||
|
|
||||||
/* Initialize this thread's ability to respond to things like
|
/* Initialize this thread's ability to respond to things like
|
||||||
SIGSEGV or SIGFPE. */
|
SIGSEGV or SIGFPE. */
|
||||||
@ -112,7 +112,7 @@ makethread (LPTHREAD_START_ROUTINE start, LPVOID param, DWORD flags,
|
|||||||
{
|
{
|
||||||
/* Search the start_buf array for an empty slot to use */
|
/* Search the start_buf array for an empty slot to use */
|
||||||
for (info = start_buf; info < start_buf + NTHREADS; info++)
|
for (info = start_buf; info < start_buf + NTHREADS; info++)
|
||||||
if (!ilockexch (&info->notavail, 1))
|
if (!InterlockedExchange (&info->notavail, 1))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* Should never hit here, but be defensive anyway. */
|
/* Should never hit here, but be defensive anyway. */
|
||||||
|
@ -632,11 +632,11 @@ bool
|
|||||||
sigthread::get_winapi_lock (int test)
|
sigthread::get_winapi_lock (int test)
|
||||||
{
|
{
|
||||||
if (test)
|
if (test)
|
||||||
return !ilockexch (&winapi_lock, 1);
|
return !InterlockedExchange (&winapi_lock, 1);
|
||||||
|
|
||||||
/* Need to do a busy loop because we can't block or a potential SuspendThread
|
/* Need to do a busy loop because we can't block or a potential SuspendThread
|
||||||
will hang. */
|
will hang. */
|
||||||
while (ilockexch (&winapi_lock, 1))
|
while (InterlockedExchange (&winapi_lock, 1))
|
||||||
Sleep (1);
|
Sleep (1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -645,7 +645,7 @@ void
|
|||||||
sigthread::release_winapi_lock ()
|
sigthread::release_winapi_lock ()
|
||||||
{
|
{
|
||||||
/* Assumes that we have the lock. */
|
/* Assumes that we have the lock. */
|
||||||
ilockexch (&winapi_lock, 0);
|
InterlockedExchange (&winapi_lock, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __stdcall interrupt_setup (int sig, void *handler, DWORD retaddr,
|
static void __stdcall interrupt_setup (int sig, void *handler, DWORD retaddr,
|
||||||
|
@ -1931,9 +1931,9 @@ wsock_init ()
|
|||||||
static LONG NO_COPY here = -1L;
|
static LONG NO_COPY here = -1L;
|
||||||
static int NO_COPY wsock_started = 0;
|
static int NO_COPY wsock_started = 0;
|
||||||
|
|
||||||
while (ilockincr (&here))
|
while (InterlockedIncrement (&here))
|
||||||
{
|
{
|
||||||
ilockdecr (&here);
|
InterlockedDecrement (&here);
|
||||||
Sleep (0);
|
Sleep (0);
|
||||||
}
|
}
|
||||||
if (!wsock_started && (wsock32_handle || ws2_32_handle))
|
if (!wsock_started && (wsock32_handle || ws2_32_handle))
|
||||||
@ -1960,6 +1960,6 @@ wsock_init ()
|
|||||||
wsock_started = 1;
|
wsock_started = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ilockdecr (&here);
|
InterlockedDecrement (&here);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ enum
|
|||||||
__SIGFLUSH = -2,
|
__SIGFLUSH = -2,
|
||||||
__SIGSTRACE = -1,
|
__SIGSTRACE = -1,
|
||||||
__SIGUNUSED = 0,
|
__SIGUNUSED = 0,
|
||||||
__SIGOFFSET = 2
|
__SIGOFFSET = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PSIZE 63
|
#define PSIZE 63
|
||||||
|
@ -10,9 +10,8 @@ This software is a copyrighted work licensed under the terms of the
|
|||||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <shlobj.h>
|
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
|
#include <shlobj.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
|
@ -473,7 +473,7 @@ proc_terminate (void)
|
|||||||
void __stdcall
|
void __stdcall
|
||||||
sig_clear (int sig)
|
sig_clear (int sig)
|
||||||
{
|
{
|
||||||
(void) ilockexch (myself->getsigtodo (sig), 0L);
|
(void) InterlockedExchange (myself->getsigtodo (sig), 0L);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,7 +696,7 @@ sig_send (_pinfo *p, int sig, DWORD ebp, bool exception)
|
|||||||
|
|
||||||
/* Increment the sigtodo array to signify which signal to assert.
|
/* Increment the sigtodo array to signify which signal to assert.
|
||||||
*/
|
*/
|
||||||
(void) ilockincr (p->getsigtodo (sig));
|
(void) InterlockedIncrement (p->getsigtodo (sig));
|
||||||
|
|
||||||
/* Notify the process that a signal has arrived.
|
/* Notify the process that a signal has arrived.
|
||||||
*/
|
*/
|
||||||
@ -783,7 +783,7 @@ out:
|
|||||||
void __stdcall
|
void __stdcall
|
||||||
sig_set_pending (int sig)
|
sig_set_pending (int sig)
|
||||||
{
|
{
|
||||||
(void) ilockincr (myself->getsigtodo (sig));
|
(void) InterlockedIncrement (myself->getsigtodo (sig));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1137,7 +1137,7 @@ wait_sig (VOID *)
|
|||||||
int dispatched_sigchld = 0;
|
int dispatched_sigchld = 0;
|
||||||
for (int sig = -__SIGOFFSET; sig < NSIG; sig++)
|
for (int sig = -__SIGOFFSET; sig < NSIG; sig++)
|
||||||
{
|
{
|
||||||
while (ilockdecr (myself->getsigtodo (sig)) >= 0)
|
while (InterlockedDecrement (myself->getsigtodo (sig)) >= 0)
|
||||||
{
|
{
|
||||||
if (sig == SIGCHLD)
|
if (sig == SIGCHLD)
|
||||||
saw_sigchld = 1;
|
saw_sigchld = 1;
|
||||||
@ -1171,14 +1171,14 @@ wait_sig (VOID *)
|
|||||||
dispatched_sigchld = 1;
|
dispatched_sigchld = 1;
|
||||||
/* Need to decrement again to offset increment below since
|
/* Need to decrement again to offset increment below since
|
||||||
we really do want to decrement in this case. */
|
we really do want to decrement in this case. */
|
||||||
ilockdecr (myself->getsigtodo (sig));
|
InterlockedDecrement (myself->getsigtodo (sig));
|
||||||
goto nextsig; /* FIXME: shouldn't this allow the loop to continue? */
|
goto nextsig; /* FIXME: shouldn't this allow the loop to continue? */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nextsig:
|
nextsig:
|
||||||
/* Decremented too far. */
|
/* Decremented too far. */
|
||||||
if (ilockincr (myself->getsigtodo (sig)) > 0)
|
if (InterlockedIncrement (myself->getsigtodo (sig)) > 0)
|
||||||
saw_pending_signals = 1;
|
saw_pending_signals = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
44
winsup/cygwin/string.h
Normal file
44
winsup/cygwin/string.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/* string.h: Extra string defs
|
||||||
|
|
||||||
|
Copyright 2001 Red Hat, Inc.
|
||||||
|
|
||||||
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
This software is a copyrighted work licensed under the terms of the
|
||||||
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
#ifndef _CYGWIN_STRING_H
|
||||||
|
#define _CYGWIN_STRING_H
|
||||||
|
|
||||||
|
#include_next <string.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef strchr
|
||||||
|
#define strchr cygwin_strchr
|
||||||
|
extern inline __stdcall char *
|
||||||
|
strchr (const char *s, int c)
|
||||||
|
{
|
||||||
|
register char * res;
|
||||||
|
__asm__ __volatile__ ("
|
||||||
|
movb %%al,%%ah\n\
|
||||||
|
1: movb (%1),%%al\n\
|
||||||
|
cmpb %%ah,%%al\n\
|
||||||
|
je 2f\n\
|
||||||
|
incl %1\n\
|
||||||
|
testb %%al,%%al\n\
|
||||||
|
jne 1b\n\
|
||||||
|
xorl %1,%1\n\
|
||||||
|
2: movl %1,%0\n\
|
||||||
|
":"=a" (__res), "=r" (s)
|
||||||
|
:"0" (c), "1" (s));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* _CYGWIN_STRING_H */
|
@ -58,7 +58,7 @@ muto::~muto ()
|
|||||||
be handled correctly.
|
be handled correctly.
|
||||||
|
|
||||||
Note: The goal here is to minimize, as much as possible, calls to the
|
Note: The goal here is to minimize, as much as possible, calls to the
|
||||||
OS. Hence the use of ilockincr, etc., rather than (much) more
|
OS. Hence the use of InterlockedIncrement, etc., rather than (much) more
|
||||||
expensive OS mutexes. */
|
expensive OS mutexes. */
|
||||||
int
|
int
|
||||||
muto::acquire (DWORD ms)
|
muto::acquire (DWORD ms)
|
||||||
@ -69,7 +69,7 @@ muto::acquire (DWORD ms)
|
|||||||
{
|
{
|
||||||
/* Increment the waiters part of the class. Need to do this first to
|
/* Increment the waiters part of the class. Need to do this first to
|
||||||
avoid potential races. */
|
avoid potential races. */
|
||||||
LONG was_waiting = ilockincr (&waiters);
|
LONG was_waiting = InterlockedIncrement (&waiters);
|
||||||
|
|
||||||
/* This is deceptively simple. Basically, it allows multiple attempts to
|
/* This is deceptively simple. Basically, it allows multiple attempts to
|
||||||
lock the same muto to succeed without attempting to manipulate sync.
|
lock the same muto to succeed without attempting to manipulate sync.
|
||||||
@ -82,7 +82,7 @@ muto::acquire (DWORD ms)
|
|||||||
case, it is possible for a thread which is going to wait for bruteforce
|
case, it is possible for a thread which is going to wait for bruteforce
|
||||||
to wake up immediately. It will then attempt to grab sync but will fail
|
to wake up immediately. It will then attempt to grab sync but will fail
|
||||||
and go back to waiting. */
|
and go back to waiting. */
|
||||||
while (tid != this_tid && (was_waiting || ilockexch (&sync, 1) != 0))
|
while (tid != this_tid && (was_waiting || InterlockedExchange (&sync, 1) != 0))
|
||||||
{
|
{
|
||||||
switch (WaitForSingleObject (bruteforce, ms))
|
switch (WaitForSingleObject (bruteforce, ms))
|
||||||
{
|
{
|
||||||
@ -90,7 +90,7 @@ muto::acquire (DWORD ms)
|
|||||||
goto gotit;
|
goto gotit;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ilockdecr (&waiters);
|
InterlockedDecrement (&waiters);
|
||||||
return 0; /* failed. */
|
return 0; /* failed. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,11 +117,11 @@ muto::release ()
|
|||||||
if (!--visits)
|
if (!--visits)
|
||||||
{
|
{
|
||||||
tid = 0; /* We were the last unlocker. */
|
tid = 0; /* We were the last unlocker. */
|
||||||
(void) ilockexch (&sync, 0); /* Reset trigger. */
|
(void) InterlockedExchange (&sync, 0); /* Reset trigger. */
|
||||||
/* This thread had incremented waiters but had never decremented it.
|
/* This thread had incremented waiters but had never decremented it.
|
||||||
Decrement it now. If it is >= 0 then there are possibly other
|
Decrement it now. If it is >= 0 then there are possibly other
|
||||||
threads waiting for the lock, so trigger bruteforce. */
|
threads waiting for the lock, so trigger bruteforce. */
|
||||||
if (ilockdecr (&waiters) >= 0)
|
if (InterlockedDecrement (&waiters) >= 0)
|
||||||
(void) SetEvent (bruteforce); /* Wake up one of the waiting threads */
|
(void) SetEvent (bruteforce); /* Wake up one of the waiting threads */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ void
|
|||||||
muto::reset ()
|
muto::reset ()
|
||||||
{
|
{
|
||||||
visits = sync = tid = 0;
|
visits = sync = tid = 0;
|
||||||
ilockexch (&waiters, -1);
|
InterlockedExchange (&waiters, -1);
|
||||||
if (bruteforce)
|
if (bruteforce)
|
||||||
{
|
{
|
||||||
CloseHandle (bruteforce);
|
CloseHandle (bruteforce);
|
||||||
|
@ -412,7 +412,7 @@ pthread_cond::BroadCast ()
|
|||||||
if (!verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC))
|
if (!verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC))
|
||||||
return;
|
return;
|
||||||
PulseEvent (win32_obj_id);
|
PulseEvent (win32_obj_id);
|
||||||
while (ilockdecr (&waiting) != 0)
|
while (InterlockedDecrement (&waiting) != 0)
|
||||||
PulseEvent (win32_obj_id);
|
PulseEvent (win32_obj_id);
|
||||||
mutex = NULL;
|
mutex = NULL;
|
||||||
}
|
}
|
||||||
@ -798,7 +798,7 @@ __pthread_create (pthread_t * thread, const pthread_attr_t * attr,
|
|||||||
*thread = NULL;
|
*thread = NULL;
|
||||||
return EAGAIN;
|
return EAGAIN;
|
||||||
}
|
}
|
||||||
ilockincr (&MT_INTERFACE->threadcount);
|
InterlockedIncrement (&MT_INTERFACE->threadcount);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1073,7 +1073,7 @@ __pthread_testcancel (void)
|
|||||||
/*
|
/*
|
||||||
* Races in pthread_atfork:
|
* Races in pthread_atfork:
|
||||||
* We are race safe in that any additions to the lists are made via
|
* We are race safe in that any additions to the lists are made via
|
||||||
* ilockexch.
|
* InterlockedExchangePointer.
|
||||||
* However, if the user application doesn't perform syncronisation of some sort
|
* However, if the user application doesn't perform syncronisation of some sort
|
||||||
* It's not guaranteed that a near simultaneous call to pthread_atfork and fork
|
* It's not guaranteed that a near simultaneous call to pthread_atfork and fork
|
||||||
* will result in the new atfork handlers being calls.
|
* will result in the new atfork handlers being calls.
|
||||||
@ -1084,7 +1084,7 @@ __pthread_testcancel (void)
|
|||||||
* will result in an indeterminate order for parent and child calls (what gets inserted
|
* will result in an indeterminate order for parent and child calls (what gets inserted
|
||||||
* first isn't guaranteed.)
|
* first isn't guaranteed.)
|
||||||
*
|
*
|
||||||
* There is one potential race... Does the result of ilockexch
|
* There is one potential race... Does the result of InterlockedExchangePointer
|
||||||
* get committed to the return location _before_ any context switches can occur?
|
* get committed to the return location _before_ any context switches can occur?
|
||||||
* If yes, we're safe, if no, we're not.
|
* If yes, we're safe, if no, we're not.
|
||||||
*/
|
*/
|
||||||
@ -1123,7 +1123,7 @@ __pthread_atforkchild (void)
|
|||||||
|
|
||||||
/* FIXME: implement InterlockExchangePointer and get rid of the silly typecasts below
|
/* FIXME: implement InterlockExchangePointer and get rid of the silly typecasts below
|
||||||
*/
|
*/
|
||||||
/*#define ilockexch ilockExchange */
|
#define InterlockedExchangePointer InterlockedExchange
|
||||||
|
|
||||||
/* Register a set of functions to run before and after fork.
|
/* Register a set of functions to run before and after fork.
|
||||||
* prepare calls are called in LI-FC order.
|
* prepare calls are called in LI-FC order.
|
||||||
@ -1165,7 +1165,7 @@ __pthread_atfork (void (*prepare)(void), void (*parent)(void), void (*child)(voi
|
|||||||
if (prepcb)
|
if (prepcb)
|
||||||
{
|
{
|
||||||
prepcb->cb = prepare;
|
prepcb->cb = prepare;
|
||||||
prepcb->next=(callback *)ilockexch ((LONG *) &MT_INTERFACE->pthread_prepare, (long int) prepcb);
|
prepcb->next=(callback *)InterlockedExchangePointer ((LONG *) &MT_INTERFACE->pthread_prepare, (long int) prepcb);
|
||||||
}
|
}
|
||||||
if (parentcb)
|
if (parentcb)
|
||||||
{
|
{
|
||||||
@ -1174,7 +1174,7 @@ __pthread_atfork (void (*prepare)(void), void (*parent)(void), void (*child)(voi
|
|||||||
while (*t)
|
while (*t)
|
||||||
t = &(*t)->next;
|
t = &(*t)->next;
|
||||||
/* t = pointer to last next in the list */
|
/* t = pointer to last next in the list */
|
||||||
parentcb->next=(callback *)ilockexch ((LONG *) t, (long int) parentcb);
|
parentcb->next=(callback *)InterlockedExchangePointer ((LONG *) t, (long int) parentcb);
|
||||||
}
|
}
|
||||||
if (childcb)
|
if (childcb)
|
||||||
{
|
{
|
||||||
@ -1183,7 +1183,7 @@ __pthread_atfork (void (*prepare)(void), void (*parent)(void), void (*child)(voi
|
|||||||
while (*t)
|
while (*t)
|
||||||
t = &(*t)->next;
|
t = &(*t)->next;
|
||||||
/* t = pointer to last next in the list */
|
/* t = pointer to last next in the list */
|
||||||
childcb->next=(callback *)ilockexch ((LONG *) t, (long int) childcb);
|
childcb->next=(callback *)InterlockedExchangePointer ((LONG *) t, (long int) childcb);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1351,7 +1351,7 @@ __pthread_exit (void *value_ptr)
|
|||||||
MT_INTERFACE->destructors.IterateNull ();
|
MT_INTERFACE->destructors.IterateNull ();
|
||||||
|
|
||||||
thread->return_ptr = value_ptr;
|
thread->return_ptr = value_ptr;
|
||||||
if (ilockdecr (&MT_INTERFACE->threadcount) == 0)
|
if (InterlockedDecrement (&MT_INTERFACE->threadcount) == 0)
|
||||||
exit (0);
|
exit (0);
|
||||||
else
|
else
|
||||||
ExitThread (0);
|
ExitThread (0);
|
||||||
@ -1626,15 +1626,15 @@ __pthread_cond_timedwait (pthread_cond_t * cond, pthread_mutex_t * mutex,
|
|||||||
if ((*cond)->waiting)
|
if ((*cond)->waiting)
|
||||||
if ((*cond)->mutex && ((*cond)->mutex != (*themutex)))
|
if ((*cond)->mutex && ((*cond)->mutex != (*themutex)))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
ilockincr (&((*cond)->waiting));
|
InterlockedIncrement (&((*cond)->waiting));
|
||||||
|
|
||||||
(*cond)->mutex = (*themutex);
|
(*cond)->mutex = (*themutex);
|
||||||
ilockincr (&((*themutex)->condwaits));
|
InterlockedIncrement (&((*themutex)->condwaits));
|
||||||
rv = (*cond)->TimedWait (abstime->tv_sec * 1000);
|
rv = (*cond)->TimedWait (abstime->tv_sec * 1000);
|
||||||
(*cond)->mutex->Lock ();
|
(*cond)->mutex->Lock ();
|
||||||
if (ilockdecr (&((*cond)->waiting)) == 0)
|
if (InterlockedDecrement (&((*cond)->waiting)) == 0)
|
||||||
(*cond)->mutex = NULL;
|
(*cond)->mutex = NULL;
|
||||||
ilockdecr (&((*themutex)->condwaits));
|
InterlockedDecrement (&((*themutex)->condwaits));
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -1657,15 +1657,15 @@ __pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex)
|
|||||||
if ((*cond)->waiting)
|
if ((*cond)->waiting)
|
||||||
if ((*cond)->mutex && ((*cond)->mutex != (*themutex)))
|
if ((*cond)->mutex && ((*cond)->mutex != (*themutex)))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
ilockincr (&((*cond)->waiting));
|
InterlockedIncrement (&((*cond)->waiting));
|
||||||
|
|
||||||
(*cond)->mutex = (*themutex);
|
(*cond)->mutex = (*themutex);
|
||||||
ilockincr (&((*themutex)->condwaits));
|
InterlockedIncrement (&((*themutex)->condwaits));
|
||||||
rv = (*cond)->TimedWait (INFINITE);
|
rv = (*cond)->TimedWait (INFINITE);
|
||||||
(*cond)->mutex->Lock ();
|
(*cond)->mutex->Lock ();
|
||||||
if (ilockdecr (&((*cond)->waiting)) == 0)
|
if (InterlockedDecrement (&((*cond)->waiting)) == 0)
|
||||||
(*cond)->mutex = NULL;
|
(*cond)->mutex = NULL;
|
||||||
ilockdecr (&((*themutex)->condwaits));
|
InterlockedDecrement (&((*themutex)->condwaits));
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,6 @@ details. */
|
|||||||
|
|
||||||
#define __INSIDE_CYGWIN__
|
#define __INSIDE_CYGWIN__
|
||||||
|
|
||||||
#include "interlock.h"
|
|
||||||
|
|
||||||
#define alloca __builtin_alloca
|
#define alloca __builtin_alloca
|
||||||
#define strlen __builtin_strlen
|
#define strlen __builtin_strlen
|
||||||
#define strcmp __builtin_strcmp
|
#define strcmp __builtin_strcmp
|
||||||
@ -35,7 +33,6 @@ details. */
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/strace.h>
|
#include <sys/strace.h>
|
||||||
|
|
||||||
|
|
||||||
extern char case_folded_lower[];
|
extern char case_folded_lower[];
|
||||||
#define cyg_tolower(c) (case_folded_lower[(unsigned char)(c)])
|
#define cyg_tolower(c) (case_folded_lower[(unsigned char)(c)])
|
||||||
extern char case_folded_upper[];
|
extern char case_folded_upper[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user