Add mutex when change AP state.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <chen.fan.f...@cn.fujitsu.com>
---
 EmulatorPkg/CpuRuntimeDxe/MpService.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/EmulatorPkg/CpuRuntimeDxe/MpService.c 
b/EmulatorPkg/CpuRuntimeDxe/MpService.c
index 792d0e4..9d67b86 100644
--- a/EmulatorPkg/CpuRuntimeDxe/MpService.c
+++ b/EmulatorPkg/CpuRuntimeDxe/MpService.c
@@ -512,11 +512,16 @@ CpuMpServicesStartupAllAps (
         if (SingleThread) {
           Status = GetNextBlockedNumber (&NextNumber);
           if (!EFI_ERROR (Status)) {
+            gThread->MutexLock 
(&gMPSystem.ProcessorData[NextNumber].StateLock);
             gMPSystem.ProcessorData[NextNumber].State = CPU_STATE_READY;
+            gThread->MutexUnlock 
(&gMPSystem.ProcessorData[NextNumber].StateLock);
           }
         }
 
+        gThread->MutexLock (ProcessorData->StateLock);
         ProcessorData->State = CPU_STATE_IDLE;
+        gThread->MutexUnlock (ProcessorData->StateLock);
+
         break;
 
       default:
-- 
1.9.3


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to