mirror of
https://github.com/reactos/reactos.git
synced 2024-07-09 06:05:11 +00:00
Make ntuser locks use eresource instead of mutex.
Fix corresponding FIXME in class.c svn path=/trunk/; revision=25922
This commit is contained in:
parent
4481a26504
commit
05d4dee367
|
@ -1,58 +1,23 @@
|
||||||
#ifndef _WIN32K_NTUSER_H
|
#ifndef _WIN32K_NTUSER_H
|
||||||
#define _WIN32K_NTUSER_H
|
#define _WIN32K_NTUSER_H
|
||||||
|
|
||||||
|
|
||||||
extern char* _file;
|
|
||||||
extern DWORD _line;
|
|
||||||
extern DWORD _locked;
|
|
||||||
|
|
||||||
extern FAST_MUTEX UserLock;
|
|
||||||
|
|
||||||
#define DECLARE_RETURN(type) type _ret_
|
#define DECLARE_RETURN(type) type _ret_
|
||||||
#define RETURN(value) { _ret_ = value; goto _cleanup_; }
|
#define RETURN(value) { _ret_ = value; goto _cleanup_; }
|
||||||
#define CLEANUP /*unreachable*/ ASSERT(FALSE); _cleanup_
|
#define CLEANUP /*unreachable*/ ASSERT(FALSE); _cleanup_
|
||||||
#define END_CLEANUP return _ret_;
|
#define END_CLEANUP return _ret_;
|
||||||
|
|
||||||
|
|
||||||
#define UserEnterCo() UserEnterExclusive()
|
#define UserEnterCo UserEnterExclusive
|
||||||
#define UserLeaveCo() UserLeave()
|
#define UserLeaveCo UserLeave
|
||||||
|
|
||||||
#define UserEnterShared() UserEnterExclusive()
|
|
||||||
|
|
||||||
#define UserEnterExclusive() \
|
|
||||||
{ \
|
|
||||||
/* DPRINT1("try xlock, %s, %i (%i)\n",__FILE__,__LINE__, _locked);*/ \
|
|
||||||
if (UserLock.Owner == KeGetCurrentThread()){ \
|
|
||||||
DPRINT1("file %s, line %i\n",_file, _line); \
|
|
||||||
ASSERT(FALSE); \
|
|
||||||
} \
|
|
||||||
UUserEnterExclusive(); \
|
|
||||||
ASSERT(InterlockedIncrement((PLONG)(&_locked)) == 1 /*> 0*/); \
|
|
||||||
_file = __FILE__; _line = __LINE__; \
|
|
||||||
/* DPRINT("got lock, %s, %i (%i)\n",__FILE__,__LINE__, _locked);*/ \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define UserLeave() \
|
|
||||||
{ \
|
|
||||||
ASSERT(InterlockedDecrement((PLONG)(&_locked)) == 0/*>= 0*/); \
|
|
||||||
/*DPRINT("unlock, %s, %i (%i)\n",__FILE__,__LINE__, _locked);*/ \
|
|
||||||
if (UserLock.Owner != KeGetCurrentThread()) { \
|
|
||||||
DPRINT1("file %s, line %i\n",_file, _line); \
|
|
||||||
ASSERT(FALSE); \
|
|
||||||
} \
|
|
||||||
_file = __FILE__; _line = __LINE__; \
|
|
||||||
UUserLeave(); \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS FASTCALL InitUserImpl(VOID);
|
NTSTATUS FASTCALL InitUserImpl(VOID);
|
||||||
VOID FASTCALL UninitUser(VOID);
|
VOID FASTCALL CleanupUserImpl(VOID);
|
||||||
VOID FASTCALL UUserEnterShared(VOID);
|
VOID FASTCALL UserEnterShared(VOID);
|
||||||
VOID FASTCALL UUserEnterExclusive(VOID);
|
VOID FASTCALL UserEnterExclusive(VOID);
|
||||||
VOID FASTCALL UUserLeave(VOID);
|
VOID FASTCALL UserLeave(VOID);
|
||||||
BOOL FASTCALL UserIsEntered();
|
BOOL FASTCALL UserIsEntered();
|
||||||
|
BOOL FASTCALL UserIsEnteredExclusive();
|
||||||
|
|
||||||
|
|
||||||
#endif /* _WIN32K_NTUSER_H */
|
#endif /* _WIN32K_NTUSER_H */
|
||||||
|
|
|
@ -220,7 +220,7 @@ IntGetClassWndProc(IN PWINDOWCLASS Class,
|
||||||
IN BOOL Ansi,
|
IN BOOL Ansi,
|
||||||
IN BOOL UseCallProc2)
|
IN BOOL UseCallProc2)
|
||||||
{
|
{
|
||||||
/* FIXME - assert for exclusive lock! */
|
ASSERT(UserIsEnteredExclusive() == TRUE);
|
||||||
|
|
||||||
if (Class->System)
|
if (Class->System)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,25 +33,16 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
ERESOURCE UserLock;
|
||||||
FAST_MUTEX UserLock;
|
|
||||||
|
|
||||||
char* _file;
|
|
||||||
DWORD _line;
|
|
||||||
DWORD _locked=0;
|
|
||||||
|
|
||||||
/* FUNCTIONS **********************************************************/
|
/* FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS FASTCALL InitUserImpl(VOID)
|
NTSTATUS FASTCALL InitUserImpl(VOID)
|
||||||
{
|
{
|
||||||
//PVOID mem;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
// DPRINT("Enter InitUserImpl\n");
|
ExInitializeResourceLite(&UserLock);
|
||||||
// ExInitializeResourceLite(&UserLock);
|
|
||||||
|
|
||||||
ExInitializeFastMutex(&UserLock);
|
|
||||||
|
|
||||||
if (!ObmCreateHandleTable())
|
if (!ObmCreateHandleTable())
|
||||||
{
|
{
|
||||||
|
@ -75,41 +66,31 @@ RETURN
|
||||||
*/
|
*/
|
||||||
BOOL FASTCALL UserIsEntered()
|
BOOL FASTCALL UserIsEntered()
|
||||||
{
|
{
|
||||||
return (UserLock.Owner == KeGetCurrentThread());
|
return ExIsResourceAcquiredExclusiveLite(&UserLock)
|
||||||
|
|| ExIsResourceAcquiredSharedLite(&UserLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL FASTCALL UserIsEnteredExclusive()
|
||||||
VOID FASTCALL CleanupUser(VOID)
|
|
||||||
{
|
{
|
||||||
// ExDeleteResourceLite(&UserLock);
|
return ExIsResourceAcquiredExclusiveLite(&UserLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL UUserEnterShared(VOID)
|
VOID FASTCALL CleanupUserImpl(VOID)
|
||||||
{
|
{
|
||||||
// DPRINT("Enter IntLockUserShared\n");
|
ExDeleteResourceLite(&UserLock);
|
||||||
// KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
|
||||||
//DPRINT("%x\n",__builtin_return_address(0));
|
|
||||||
// KeEnterCriticalRegion();
|
|
||||||
// ExAcquireResourceSharedLite(&UserLock, TRUE);
|
|
||||||
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&UserLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL UUserEnterExclusive(VOID)
|
VOID FASTCALL UserEnterShared(VOID)
|
||||||
{
|
{
|
||||||
// DPRINT("Enter UserEnterExclusive\n");
|
ExAcquireResourceSharedLite(&UserLock, TRUE);
|
||||||
// KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
|
||||||
//DPRINT("%x\n",__builtin_return_address(0));
|
|
||||||
// KeEnterCriticalRegion();
|
|
||||||
// ExAcquireResourceExclusiveLite(&UserLock, TRUE);
|
|
||||||
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&UserLock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL UUserLeave(VOID)
|
VOID FASTCALL UserEnterExclusive(VOID)
|
||||||
{
|
{
|
||||||
// DPRINT("Enter UserLeave\n");
|
ExAcquireResourceExclusiveLite(&UserLock, TRUE);
|
||||||
// KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
}
|
||||||
//DPRINT("%x\n",__builtin_return_address(0));
|
|
||||||
// ExReleaseResourceLite(&UserLock);
|
VOID FASTCALL UserLeave(VOID)
|
||||||
// KeLeaveCriticalRegion();
|
{
|
||||||
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&UserLock);
|
ExReleaseResourceLite(&UserLock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue