Quantcast
Viewing all articles
Browse latest Browse all 12583

Context Switch Deadlock caused by Windows Media Player ActiveX

Hi,

I have two windows media activeX components on a windows form, accessing the same media file so that I can play it synchronously without the use of a media server. The media file restarts at the end so that it continuously plays. The application works perfectly and keeps in sync. However, after many hours of running in the IDE enviroment I have seen an occurrence of the the following:

"ContextSwitchDeadlock was detected Message: The CLR has been unable to transition from COM context 0x206340 to COM context 0x2064b0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations."

The stub of code where it hung is the following:

            this.axWMP1.URL = this.mediaFile;
            System.Threading.Thread.Sleep(100);
            this.axWMP2.URL = this.mediaFile;  <--- Here

The windows media player is set to autostart when a new URL is set.

Any help would be appreciated.

Andy

(MCTS)


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>