mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 20:59:54 +00:00
Moved user lock to user.c. Added USER_CheckNotLock function.
This commit is contained in:
parent
301df6b5cd
commit
6837b9c119
@ -93,6 +93,11 @@ extern USER_DRIVER USER_Driver;
|
||||
WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
|
||||
DWORD dwFlags, HMODULE16 hModule );
|
||||
|
||||
/* user lock */
|
||||
extern void USER_Lock(void);
|
||||
extern void USER_Unlock(void);
|
||||
extern void USER_CheckNotLock(void);
|
||||
|
||||
VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc);
|
||||
VOID WINAPI MOUSE_Disable(VOID);
|
||||
|
||||
|
@ -84,8 +84,6 @@ typedef struct
|
||||
#define BWA_SKIPICONIC 0x0008
|
||||
|
||||
/* Window functions */
|
||||
extern void WIN_LockWnds( void );
|
||||
extern void WIN_UnlockWnds( void );
|
||||
extern int WIN_SuspendWndsLock( void );
|
||||
extern void WIN_RestoreWndsLock(int ipreviousLock);
|
||||
extern WND* WIN_FindWndPtr( HWND hwnd );
|
||||
|
@ -45,7 +45,7 @@ static void DCE_DumpCache(void)
|
||||
{
|
||||
DCE *dce;
|
||||
|
||||
WIN_LockWnds();
|
||||
USER_Lock();
|
||||
dce = firstDCE;
|
||||
|
||||
DPRINTF("DCE:\n");
|
||||
@ -58,7 +58,7 @@ static void DCE_DumpCache(void)
|
||||
dce = dce->next;
|
||||
}
|
||||
|
||||
WIN_UnlockWnds();
|
||||
USER_Unlock();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -119,7 +119,7 @@ DCE* DCE_FreeDCE( DCE *dce )
|
||||
|
||||
if (!dce) return NULL;
|
||||
|
||||
WIN_LockWnds();
|
||||
USER_Lock();
|
||||
|
||||
ppDCE = &firstDCE;
|
||||
|
||||
@ -133,7 +133,7 @@ DCE* DCE_FreeDCE( DCE *dce )
|
||||
DeleteObject(dce->hClipRgn);
|
||||
HeapFree( GetProcessHeap(), 0, dce );
|
||||
|
||||
WIN_UnlockWnds();
|
||||
USER_Unlock();
|
||||
|
||||
return *ppDCE;
|
||||
}
|
||||
@ -147,7 +147,7 @@ void DCE_FreeWindowDCE( WND* pWnd )
|
||||
{
|
||||
DCE *pDCE;
|
||||
|
||||
WIN_LockWnds();
|
||||
USER_Lock();
|
||||
pDCE = firstDCE;
|
||||
|
||||
while( pDCE )
|
||||
@ -192,7 +192,7 @@ void DCE_FreeWindowDCE( WND* pWnd )
|
||||
pDCE = pDCE->next;
|
||||
}
|
||||
|
||||
WIN_UnlockWnds();
|
||||
USER_Unlock();
|
||||
}
|
||||
|
||||
|
||||
@ -603,7 +603,7 @@ INT WINAPI ReleaseDC(
|
||||
DCE * dce;
|
||||
INT nRet = 0;
|
||||
|
||||
WIN_LockWnds();
|
||||
USER_Lock();
|
||||
dce = firstDCE;
|
||||
|
||||
TRACE("%04x %04x\n", hwnd, hdc );
|
||||
@ -614,7 +614,7 @@ INT WINAPI ReleaseDC(
|
||||
if ( dce->DCXflags & DCX_DCEBUSY )
|
||||
nRet = DCE_ReleaseDC( dce );
|
||||
|
||||
WIN_UnlockWnds();
|
||||
USER_Unlock();
|
||||
|
||||
return nRet;
|
||||
}
|
||||
@ -635,7 +635,7 @@ BOOL16 WINAPI DCHook16( HDC16 hDC, WORD code, DWORD data, LPARAM lParam )
|
||||
assert(dce->hDC == hDC);
|
||||
|
||||
/* Grab the windows lock before doing anything else */
|
||||
WIN_LockWnds();
|
||||
USER_Lock();
|
||||
|
||||
switch( code )
|
||||
{
|
||||
@ -672,7 +672,7 @@ BOOL16 WINAPI DCHook16( HDC16 hDC, WORD code, DWORD data, LPARAM lParam )
|
||||
FIXME("unknown code\n");
|
||||
}
|
||||
|
||||
WIN_UnlockWnds(); /* Release the wnd lock */
|
||||
USER_Unlock(); /* Release the wnd lock */
|
||||
return retv;
|
||||
}
|
||||
|
||||
@ -694,13 +694,13 @@ HWND WINAPI WindowFromDC( HDC hDC )
|
||||
DCE *dce;
|
||||
HWND hwnd;
|
||||
|
||||
WIN_LockWnds();
|
||||
USER_Lock();
|
||||
dce = firstDCE;
|
||||
|
||||
while (dce && (dce->hDC != hDC)) dce = dce->next;
|
||||
|
||||
hwnd = dce ? dce->hwndCurrent : 0;
|
||||
WIN_UnlockWnds();
|
||||
USER_Unlock();
|
||||
|
||||
return hwnd;
|
||||
}
|
||||
|
@ -31,6 +31,9 @@ DECLARE_DEBUG_CHANNEL(system);
|
||||
DECLARE_DEBUG_CHANNEL(win);
|
||||
DECLARE_DEBUG_CHANNEL(win32);
|
||||
|
||||
SYSLEVEL USER_SysLevel = { CRITICAL_SECTION_INIT("USER_SysLevel"), 2 };
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetFreeSystemResources (USER.284)
|
||||
*/
|
||||
@ -88,6 +91,36 @@ INT16 WINAPI InitApp16( HINSTANCE16 hInstance )
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* USER_Lock
|
||||
*/
|
||||
void USER_Lock(void)
|
||||
{
|
||||
_EnterSysLevel( &USER_SysLevel );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* USER_Unlock
|
||||
*/
|
||||
void USER_Unlock(void)
|
||||
{
|
||||
_LeaveSysLevel( &USER_SysLevel );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* USER_CheckNotLock
|
||||
*
|
||||
* Make sure that we don't hold the user lock.
|
||||
*/
|
||||
void USER_CheckNotLock(void)
|
||||
{
|
||||
_CheckNotSysLevel( &USER_SysLevel );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* USER_ModuleUnload
|
||||
*/
|
||||
|
@ -38,27 +38,7 @@ static WORD wDragWidth = 4;
|
||||
static WORD wDragHeight= 3;
|
||||
|
||||
/* thread safeness */
|
||||
static SYSLEVEL WIN_SysLevel = { CRITICAL_SECTION_INIT, 2 };
|
||||
|
||||
/***********************************************************************
|
||||
* WIN_LockWnds
|
||||
*
|
||||
* Locks access to all WND structures for thread safeness
|
||||
*/
|
||||
void WIN_LockWnds( void )
|
||||
{
|
||||
_EnterSysLevel( &WIN_SysLevel );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* WIN_UnlockWnds
|
||||
*
|
||||
* Unlocks access to all WND structures
|
||||
*/
|
||||
void WIN_UnlockWnds( void )
|
||||
{
|
||||
_LeaveSysLevel( &WIN_SysLevel );
|
||||
}
|
||||
extern SYSLEVEL USER_SysLevel; /* FIXME */
|
||||
|
||||
/***********************************************************************
|
||||
* WIN_SuspendWndsLock
|
||||
@ -68,11 +48,11 @@ void WIN_UnlockWnds( void )
|
||||
*/
|
||||
int WIN_SuspendWndsLock( void )
|
||||
{
|
||||
int isuspendedLocks = _ConfirmSysLevel( &WIN_SysLevel );
|
||||
int isuspendedLocks = _ConfirmSysLevel( &USER_SysLevel );
|
||||
int count = isuspendedLocks;
|
||||
|
||||
while ( count-- > 0 )
|
||||
_LeaveSysLevel( &WIN_SysLevel );
|
||||
_LeaveSysLevel( &USER_SysLevel );
|
||||
|
||||
return isuspendedLocks;
|
||||
}
|
||||
@ -85,7 +65,7 @@ int WIN_SuspendWndsLock( void )
|
||||
void WIN_RestoreWndsLock( int ipreviousLocks )
|
||||
{
|
||||
while ( ipreviousLocks-- > 0 )
|
||||
_EnterSysLevel( &WIN_SysLevel );
|
||||
_EnterSysLevel( &USER_SysLevel );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -100,7 +80,7 @@ WND * WIN_FindWndPtr( HWND hwnd )
|
||||
if (!hwnd || HIWORD(hwnd)) goto error2;
|
||||
ptr = (WND *) USER_HEAP_LIN_ADDR( hwnd );
|
||||
/* Lock all WND structures for thread safeness*/
|
||||
WIN_LockWnds();
|
||||
USER_Lock();
|
||||
/*and increment destruction monitoring*/
|
||||
ptr->irefCount++;
|
||||
|
||||
@ -114,7 +94,7 @@ WND * WIN_FindWndPtr( HWND hwnd )
|
||||
return ptr;
|
||||
error:
|
||||
/* Unlock all WND structures for thread safeness*/
|
||||
WIN_UnlockWnds();
|
||||
USER_Unlock();
|
||||
/* and decrement destruction monitoring value */
|
||||
ptr->irefCount--;
|
||||
|
||||
@ -136,7 +116,7 @@ WND *WIN_LockWndPtr(WND *initWndPtr)
|
||||
if(!initWndPtr) return 0;
|
||||
|
||||
/* Lock all WND structures for thread safeness*/
|
||||
WIN_LockWnds();
|
||||
USER_Lock();
|
||||
/*and increment destruction monitoring*/
|
||||
initWndPtr->irefCount++;
|
||||
|
||||
@ -168,7 +148,7 @@ void WIN_ReleaseWndPtr(WND *wndPtr)
|
||||
ERR("forgot a Lock on %p somewhere\n",wndPtr);
|
||||
}
|
||||
/*unlock all WND structures for thread safeness*/
|
||||
WIN_UnlockWnds();
|
||||
USER_Unlock();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user