Added names to standard critical sections (suggested by Andreas

Mohr).
This commit is contained in:
Alexandre Julliard 2001-08-16 18:12:56 +00:00
parent 06abe79037
commit 301df6b5cd
17 changed files with 23 additions and 18 deletions

View File

@ -141,6 +141,7 @@ static inline HANDLE get_semaphore( RTL_CRITICAL_SECTION *crit )
*/
NTSTATUS WINAPI RtlInitializeCriticalSection( RTL_CRITICAL_SECTION *crit )
{
crit->DebugInfo = NULL;
crit->LockCount = -1;
crit->RecursionCount = 0;
crit->OwningThread = 0;
@ -190,11 +191,15 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
DWORD res = WaitForSingleObject( sem, 5000L );
if ( res == WAIT_TIMEOUT )
{
ERR("Critical section %p wait timed out, retrying (60 sec) fs=%04x\n", crit, __get_fs() );
const char *name = (char *)crit->DebugInfo;
if (!name || IsBadStringPtrA(name,80)) name = "?";
ERR( "section %p %s wait timed out, retrying (60 sec) fs=%04x\n",
crit, debugstr_a(name), __get_fs() );
res = WaitForSingleObject( sem, 60000L );
if ( res == WAIT_TIMEOUT && TRACE_ON(relay) )
{
ERR("Critical section %p wait timed out, retrying (5 min) fs=%04x\n", crit, __get_fs() );
ERR( "section %p %s wait timed out, retrying (5 min) fs=%04x\n",
crit, debugstr_a(name), __get_fs() );
res = WaitForSingleObject( sem, 300000L );
}
}

View File

@ -21,7 +21,7 @@
DEFAULT_DEBUG_CHANNEL(ntdll);
static RTL_CRITICAL_SECTION peb_lock = CRITICAL_SECTION_INIT;
static RTL_CRITICAL_SECTION peb_lock = CRITICAL_SECTION_INIT("peb_lock");
/*
* resource functions

View File

@ -14,7 +14,7 @@
DEFAULT_DEBUG_CHANNEL(shell);
static CRITICAL_SECTION SHELL32_ChangenotifyCS = CRITICAL_SECTION_INIT;
static CRITICAL_SECTION SHELL32_ChangenotifyCS = CRITICAL_SECTION_INIT("SHELL32_ChangenotifyCS");
/* internal list of notification clients (internal) */
typedef struct _NOTIFICATIONLIST

View File

@ -37,7 +37,7 @@ typedef struct
} SIC_ENTRY, * LPSIC_ENTRY;
static HDPA sic_hdpa = 0;
static CRITICAL_SECTION SHELL32_SicCS = CRITICAL_SECTION_INIT;
static CRITICAL_SECTION SHELL32_SicCS = CRITICAL_SECTION_INIT("SHELL32_SicCS");
/*****************************************************************************
* SIC_CompareEntrys [called by comctl32.dll]

View File

@ -27,7 +27,7 @@ DEFAULT_DEBUG_CHANNEL(ddeml);
static WDML_INSTANCE* WDML_InstanceList = NULL;
static DWORD WDML_MaxInstanceID = 0; /* OK for present, have to worry about wrap-around later */
const char WDML_szEventClass[] = "DdeEventClass";
CRITICAL_SECTION WDML_CritSect = CRITICAL_SECTION_INIT;
CRITICAL_SECTION WDML_CritSect = CRITICAL_SECTION_INIT("WDML_CritSect");
/* ================================================================
*

View File

@ -30,7 +30,7 @@ DEFAULT_DEBUG_CHANNEL(aspi);
#ifdef linux
static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
static CRITICAL_SECTION ASPI_CritSection = CRITICAL_SECTION_INIT;
static CRITICAL_SECTION ASPI_CritSection = CRITICAL_SECTION_INIT("ASPI_CritSection");
#endif /* defined(linux) */

View File

@ -91,7 +91,7 @@ DEFAULT_DEBUG_CHANNEL(winsock);
/* critical section to protect some non-rentrant net function */
CRITICAL_SECTION csWSgetXXXbyYYY = CRITICAL_SECTION_INIT;
CRITICAL_SECTION csWSgetXXXbyYYY = CRITICAL_SECTION_INIT("csWSgetXXXbyYYY");
/* protoptypes of some functions in socket.c
*/

View File

@ -47,7 +47,7 @@ DEFAULT_DEBUG_CHANNEL(x11drv);
static void (*old_tsx11_lock)(void);
static void (*old_tsx11_unlock)(void);
static CRITICAL_SECTION X11DRV_CritSection = CRITICAL_SECTION_INIT;
static CRITICAL_SECTION X11DRV_CritSection = CRITICAL_SECTION_INIT("X11DRV_CritSection");
Screen *screen;
Visual *visual;

View File

@ -79,7 +79,7 @@ static char PROFILE_WineIniUsed[MAX_PATHNAME_LEN] = "";
static const WCHAR wininiW[] = { 'w','i','n','.','i','n','i',0 };
static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT;
static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT("PROFILE_CritSect");
static const char hex[16] = "0123456789ABCDEF";

View File

@ -306,7 +306,7 @@ static const struct CharsetBindingInfo charsetbindings[] =
static int DefResolution = 0;
static CRITICAL_SECTION crtsc_fonts_X11 = CRITICAL_SECTION_INIT;
static CRITICAL_SECTION crtsc_fonts_X11 = CRITICAL_SECTION_INIT("crtsc_fonts_X11");
static fontResource* fontList = NULL;
static fontObject* fontCache = NULL; /* array */

View File

@ -986,7 +986,7 @@ typedef DWORD CALLBACK (*LPPROGRESS_ROUTINE)(LARGE_INTEGER, LARGE_INTEGER, LARGE
#define FORMAT_MESSAGE_MAX_WIDTH_MASK 0x000000FF
#ifdef __WINE__
#define CRITICAL_SECTION_INIT { 0, -1, 0, 0, 0, 0 }
#define CRITICAL_SECTION_INIT(name) { (void *)(__FILE__ ": " name), -1, 0, 0, 0, 0 }
#endif
typedef struct {

View File

@ -81,7 +81,7 @@ static const BYTE VIRTUAL_Win32Flags[16] =
static FILE_VIEW *VIRTUAL_FirstView;
static CRITICAL_SECTION csVirtual = CRITICAL_SECTION_INIT;
static CRITICAL_SECTION csVirtual = CRITICAL_SECTION_INIT("csVirtual");
#ifdef __i386__
/* These are always the same on an i386, and it will be faster this way */

View File

@ -170,7 +170,7 @@ static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] =
HBITMAP hPseudoStockBitmap; /* 1x1 bitmap for memory DCs */
static SYSLEVEL GDI_level = { CRITICAL_SECTION_INIT, 3 };
static SYSLEVEL GDI_level = { CRITICAL_SECTION_INIT("GDI_level"), 3 };
static WORD GDI_HeapSel;
static BOOL get_bool(char *buffer, BOOL def_value)

View File

@ -121,7 +121,7 @@ strong_alias(__pthread_kill_other_threads_np, pthread_kill_other_threads_np);
#define MAX_ATFORK 8 /* libc doesn't need that many anyway */
static CRITICAL_SECTION atfork_section = CRITICAL_SECTION_INIT;
static CRITICAL_SECTION atfork_section = CRITICAL_SECTION_INIT("atfork_section");
typedef void (*atfork_handler)();
static atfork_handler atfork_prepare[MAX_ATFORK];
static atfork_handler atfork_parent[MAX_ATFORK];

View File

@ -14,7 +14,7 @@
DEFAULT_DEBUG_CHANNEL(win32);
static SYSLEVEL Win16Mutex = { CRITICAL_SECTION_INIT, 1 };
static SYSLEVEL Win16Mutex = { CRITICAL_SECTION_INIT("Win16Mutex"), 1 };
/* Global variable to save current TEB while in 16-bit code */
WORD SYSLEVEL_Win16CurrentTeb = 0;

View File

@ -78,7 +78,7 @@ typedef struct tagICONCACHE
} ICONCACHE;
static ICONCACHE *IconAnchor = NULL;
static CRITICAL_SECTION IconCrst = CRITICAL_SECTION_INIT;
static CRITICAL_SECTION IconCrst = CRITICAL_SECTION_INIT("IconCrst");
static WORD ICON_HOTSPOT = 0x4242;

View File

@ -35,7 +35,7 @@ typedef struct tagTIMER
static TIMER TimersArray[NB_TIMERS];
static CRITICAL_SECTION csTimer = CRITICAL_SECTION_INIT;
static CRITICAL_SECTION csTimer = CRITICAL_SECTION_INIT("csTimer");
/***********************************************************************