mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 07:03:06 +00:00
[TCPIP] Fix global synchronization on SMP
We cannot just raise IRQL! Instead use a global ERESOURCE, which allows to be acquired recursively, as required by LWIP.
This commit is contained in:
parent
b4731b7f8f
commit
069fc049db
2 changed files with 10 additions and 4 deletions
|
@ -15,7 +15,7 @@ typedef struct _sys_mbox_t
|
|||
int Valid;
|
||||
} sys_mbox_t;
|
||||
|
||||
typedef KIRQL sys_prot_t;
|
||||
typedef u32_t sys_prot_t;
|
||||
|
||||
typedef u32_t sys_thread_t;
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
static LIST_ENTRY ThreadListHead;
|
||||
static KSPIN_LOCK ThreadListLock;
|
||||
static ERESOURCE GlobalLock;
|
||||
static ULONG GlobalLockLevel = 0;
|
||||
|
||||
KEVENT TerminationEvent;
|
||||
NPAGED_LOOKASIDE_LIST MessageLookasideList;
|
||||
|
@ -32,14 +34,18 @@ u32_t sys_now(void)
|
|||
void
|
||||
sys_arch_protect(sys_prot_t *lev)
|
||||
{
|
||||
/* Preempt the dispatcher */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, lev);
|
||||
/* Acquire the global resource to prevent other CPUs from running */
|
||||
ExEnterCriticalRegionAndAcquireResourceExclusive(&GlobalLock);
|
||||
*lev = ++GlobalLockLevel;
|
||||
}
|
||||
|
||||
void
|
||||
sys_arch_unprotect(sys_prot_t lev)
|
||||
{
|
||||
KeLowerIrql(lev);
|
||||
/* Release the global resource */
|
||||
ASSERT((GlobalLockLevel > 0) && (lev == GlobalLockLevel));
|
||||
GlobalLockLevel--;
|
||||
ExReleaseResourceAndLeaveCriticalRegion(&GlobalLock);
|
||||
}
|
||||
|
||||
err_t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue