Discussion:
Acess violation while playing/recording in multi-core/HT processor
(too old to reply)
Fabio Sobral
2009-03-24 22:54:06 UTC
Permalink
Hi.

I have an application created in C using only the Windows SDK. I'm using the
waveform api with callback_event and a worker thread both for playing and
recording.
My application runs fine on computers with single core processor and windows
mobiles devices, but it often crashes on multi-core processors.
I tried tracking down the issue, and I think the fault happens in the
message queue loop in the main thread. A simple PeekMessage (no remove),
GetMessage, TranslateMessage and DispatchMessage loop.

How can i fix this problem, or at least signal to the OS to run my
application as single process to avoid this fault while I don't find a better
solution?

Thanks.
Alexander Grigoriev
2009-03-25 04:52:16 UTC
Permalink
Make sure to use proper synchronization (a critical section, etc) to access
your shared data in different threads.
Post by Fabio Sobral
Hi.
I have an application created in C using only the Windows SDK. I'm using the
waveform api with callback_event and a worker thread both for playing and
recording.
My application runs fine on computers with single core processor and windows
mobiles devices, but it often crashes on multi-core processors.
I tried tracking down the issue, and I think the fault happens in the
message queue loop in the main thread. A simple PeekMessage (no remove),
GetMessage, TranslateMessage and DispatchMessage loop.
How can i fix this problem, or at least signal to the OS to run my
application as single process to avoid this fault while I don't find a better
solution?
Thanks.
Alessandro Angeli
2009-03-25 06:07:33 UTC
Permalink
From: "Fabio Sobral"
Post by Fabio Sobral
How can i fix this problem, or at least signal to the OS
to run my application as single process to avoid this
fault while I don't find a better solution?
The fix, as Alexander wrote, is to properly synchronize
access to shared variables among the threads. If, as a
stopgap, you just want to disable actual parallel execution,
you can use SetProcessAffinityMask(GetCurrentProcess())
using an affinity mask that only has 1 processor enabled.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
Loading...