[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] flash/flashhost/platform/win32
From:       sfu () helixcommunity ! org
Date:       2008-10-31 20:47:16
Message-ID: 200810312054.m9VKsUpB027199 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/datatype/flash/flashhost/platform/win32
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv26271/platform/win32

Modified Files:
      Tag: hxclient_3_1_0_atlas
	flash_guest_player_ax.cpp 
Log Message:
bug 227594 fix - use an event sync to avoid spinlock in PostMessage starve flash thread

Index: flash_guest_player_ax.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp,v
retrieving revision 1.21.2.63
retrieving revision 1.21.2.64
diff -u -d -r1.21.2.63 -r1.21.2.64
--- flash_guest_player_ax.cpp	29 Oct 2008 19:40:13 -0000	1.21.2.63
+++ flash_guest_player_ax.cpp	31 Oct 2008 20:47:12 -0000	1.21.2.64
@@ -3924,6 +3924,21 @@
         {
             retVal = m_pFlashThread->CreateThread(StaticFlashThreadFunc, (void*)this, 0);
         }
+
+	if (SUCCEEDED(retVal))
+        {
+            // event for Flash thread to signal finishing of a sync command
+            retVal = CreateEventCCF((void**)&m_pFlashFinishEvent, m_pContext, NULL, TRUE);
+        }
+
+	// Wait for first event as the signal that flash thread is ready to receive command
+	// Thread->PostMessage has a spinlock (Sleep(0)) waiting for the child thread to finish init msg queue
+	// Since we lower the thread priority of the child thread, the Sleep(0) spinlock will not yeild
+	// to child thread for a long time. Th event logic here makes sure we never touches the spinlock
+	// Note: the Sleep(0) in the spinlock is changed to Sleep(1)
+	m_pFlashFinishEvent->Wait(ALLFS);
+	m_pFlashFinishEvent->ResetEvent();
+
         if (SUCCEEDED(retVal))
         {
             m_pFlashThread->SetThreadName("FlashAX thread");
@@ -3933,11 +3948,6 @@
                 m_pFlashThread->SetPriority(THREAD_PRIORITY_BELOW_NORMAL);
             }
         }
-        if (SUCCEEDED(retVal))
-        {
-            // event for Flash thread to signal finishing of a sync command
-            retVal = CreateEventCCF((void**)&m_pFlashFinishEvent, m_pContext, NULL, TRUE);
-        }
     }
 }
 
@@ -4178,6 +4188,9 @@
         HX_DELETE(pRect);
     }
 
+    // tell host thread that we are ready for command
+    m_pFlashFinishEvent->SignalEvent();
+
     // use native msg handling
     MSG msg;
     while (::GetMessage(&msg, NULL, 0, 0))


_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic