mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
made the DCE list thread-safe
svn path=/trunk/; revision=8978
This commit is contained in:
parent
c89da97139
commit
0a205b8bd5
1 changed files with 40 additions and 12 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: windc.c,v 1.61 2004/03/23 18:08:07 weiden Exp $
|
/* $Id: windc.c,v 1.62 2004/04/05 20:46:15 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -49,14 +49,26 @@
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
/* NOTE - I think we should store this per window station (including gdi objects) */
|
||||||
|
|
||||||
|
static FAST_MUTEX DceListLock;
|
||||||
static PDCE FirstDce = NULL;
|
static PDCE FirstDce = NULL;
|
||||||
static HDC defaultDCstate;
|
static HDC defaultDCstate;
|
||||||
|
|
||||||
|
#define DCE_LockList ExAcquireFastMutex(&DceListLock)
|
||||||
|
#define DCE_UnlockList ExReleaseFastMutex(&DceListLock)
|
||||||
|
|
||||||
#define DCX_CACHECOMPAREMASK (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | \
|
#define DCX_CACHECOMPAREMASK (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | \
|
||||||
DCX_CACHE | DCX_WINDOW | DCX_PARENTCLIP)
|
DCX_CACHE | DCX_WINDOW | DCX_PARENTCLIP)
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
DceInit(VOID)
|
||||||
|
{
|
||||||
|
ExInitializeFastMutex(&DceListLock);
|
||||||
|
}
|
||||||
|
|
||||||
HRGN STDCALL
|
HRGN STDCALL
|
||||||
DceGetVisRgn(HWND hWnd, ULONG Flags, HWND hWndChild, ULONG CFlags)
|
DceGetVisRgn(HWND hWnd, ULONG Flags, HWND hWndChild, ULONG CFlags)
|
||||||
{
|
{
|
||||||
|
@ -111,8 +123,10 @@ DceAllocDCE(HWND hWnd, DCE_TYPE Type)
|
||||||
}
|
}
|
||||||
Dce->hwndCurrent = hWnd;
|
Dce->hwndCurrent = hWnd;
|
||||||
Dce->hClipRgn = NULL;
|
Dce->hClipRgn = NULL;
|
||||||
|
DCE_LockList;
|
||||||
Dce->next = FirstDce;
|
Dce->next = FirstDce;
|
||||||
FirstDce = Dce;
|
FirstDce = Dce;
|
||||||
|
DCE_UnlockList;
|
||||||
|
|
||||||
if (Type != DCE_CACHE_DC)
|
if (Type != DCE_CACHE_DC)
|
||||||
{
|
{
|
||||||
|
@ -409,6 +423,8 @@ NtUserGetDCEx(HWND hWnd, HANDLE ClipRegion, ULONG Flags)
|
||||||
DCE* DceEmpty = NULL;
|
DCE* DceEmpty = NULL;
|
||||||
DCE* DceUnused = NULL;
|
DCE* DceUnused = NULL;
|
||||||
|
|
||||||
|
DCE_LockList;
|
||||||
|
|
||||||
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
|
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
|
||||||
{
|
{
|
||||||
if ((Dce->DCXFlags & (DCX_CACHE | DCX_DCEBUSY)) == DCX_CACHE)
|
if ((Dce->DCXFlags & (DCX_CACHE | DCX_DCEBUSY)) == DCX_CACHE)
|
||||||
|
@ -430,6 +446,8 @@ NtUserGetDCEx(HWND hWnd, HANDLE ClipRegion, ULONG Flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DCE_UnlockList;
|
||||||
|
|
||||||
if (Dce == NULL)
|
if (Dce == NULL)
|
||||||
{
|
{
|
||||||
Dce = (DceEmpty == NULL) ? DceEmpty : DceUnused;
|
Dce = (DceEmpty == NULL) ? DceEmpty : DceUnused;
|
||||||
|
@ -556,6 +574,8 @@ DCE_InternalDelete(PDCE Dce)
|
||||||
{
|
{
|
||||||
PDCE PrevInList;
|
PDCE PrevInList;
|
||||||
|
|
||||||
|
DCE_LockList;
|
||||||
|
|
||||||
if (Dce == FirstDce)
|
if (Dce == FirstDce)
|
||||||
{
|
{
|
||||||
FirstDce = Dce->next;
|
FirstDce = Dce->next;
|
||||||
|
@ -574,6 +594,8 @@ DCE_InternalDelete(PDCE Dce)
|
||||||
assert(NULL != PrevInList);
|
assert(NULL != PrevInList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DCE_UnlockList;
|
||||||
|
|
||||||
return NULL != PrevInList;
|
return NULL != PrevInList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,13 +603,17 @@ HWND FASTCALL
|
||||||
IntWindowFromDC(HDC hDc)
|
IntWindowFromDC(HDC hDc)
|
||||||
{
|
{
|
||||||
DCE *Dce;
|
DCE *Dce;
|
||||||
|
|
||||||
|
DCE_LockList;
|
||||||
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
|
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
|
||||||
{
|
{
|
||||||
if(Dce->hDC == hDc)
|
if(Dce->hDC == hDc)
|
||||||
{
|
{
|
||||||
|
DCE_UnlockList;
|
||||||
return Dce->hwndCurrent;
|
return Dce->hwndCurrent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DCE_UnlockList;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,7 +623,8 @@ NtUserReleaseDC(HWND hWnd, HDC hDc)
|
||||||
DCE *dce;
|
DCE *dce;
|
||||||
INT nRet = 0;
|
INT nRet = 0;
|
||||||
|
|
||||||
/* FIXME USER_Lock(); */
|
DCE_LockList;
|
||||||
|
|
||||||
dce = FirstDce;
|
dce = FirstDce;
|
||||||
|
|
||||||
DPRINT("%p %p\n", hWnd, hDc);
|
DPRINT("%p %p\n", hWnd, hDc);
|
||||||
|
@ -612,7 +639,7 @@ NtUserReleaseDC(HWND hWnd, HDC hDc)
|
||||||
nRet = DceReleaseDC(dce);
|
nRet = DceReleaseDC(dce);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME USER_Unlock(); */
|
DCE_UnlockList;
|
||||||
|
|
||||||
return nRet;
|
return nRet;
|
||||||
}
|
}
|
||||||
|
@ -631,16 +658,8 @@ DceFreeDCE(PDCE dce)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* FIXME */
|
|
||||||
USER_Lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = dce->next;
|
ret = dce->next;
|
||||||
|
|
||||||
#if 0 /* FIXME */
|
|
||||||
USER_Unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0 /* FIXME */
|
#if 0 /* FIXME */
|
||||||
SetDCHook(dce->hDC, NULL, 0L);
|
SetDCHook(dce->hDC, NULL, 0L);
|
||||||
#endif
|
#endif
|
||||||
|
@ -668,6 +687,8 @@ DceFreeWindowDCE(PWINDOW_OBJECT Window)
|
||||||
{
|
{
|
||||||
DCE *pDCE;
|
DCE *pDCE;
|
||||||
|
|
||||||
|
DCE_LockList;
|
||||||
|
|
||||||
pDCE = FirstDce;
|
pDCE = FirstDce;
|
||||||
while (pDCE)
|
while (pDCE)
|
||||||
{
|
{
|
||||||
|
@ -709,15 +730,18 @@ DceFreeWindowDCE(PWINDOW_OBJECT Window)
|
||||||
}
|
}
|
||||||
pDCE = pDCE->next;
|
pDCE = pDCE->next;
|
||||||
}
|
}
|
||||||
|
DCE_UnlockList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FASTCALL
|
void FASTCALL
|
||||||
DceEmptyCache()
|
DceEmptyCache()
|
||||||
{
|
{
|
||||||
|
DCE_LockList;
|
||||||
while (FirstDce != NULL)
|
while (FirstDce != NULL)
|
||||||
{
|
{
|
||||||
DceFreeDCE(FirstDce);
|
DceFreeDCE(FirstDce);
|
||||||
}
|
}
|
||||||
|
DCE_UnlockList;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
|
@ -732,6 +756,8 @@ DceResetActiveDCEs(PWINDOW_OBJECT Window, int DeltaX, int DeltaY)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DCE_LockList;
|
||||||
|
|
||||||
pDCE = FirstDce;
|
pDCE = FirstDce;
|
||||||
while (pDCE)
|
while (pDCE)
|
||||||
{
|
{
|
||||||
|
@ -785,6 +811,8 @@ DceResetActiveDCEs(PWINDOW_OBJECT Window, int DeltaX, int DeltaY)
|
||||||
}
|
}
|
||||||
pDCE = pDCE->next;
|
pDCE = pDCE->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DCE_UnlockList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue