Re: Multiple threads and msacm32 (Was A few questions, re: sound and other.)

Ove Kaaven <[email protected]> Thu, 09 Dec 2004 10:34:37 -0500
Newsgroups gmane.comp.emulators.winex.devel
Organization TransGaming Technologies Inc
Message-ID <1102606477.14092.14.camel@renegade>
tor, 09,.12.2004 kl. 19.32 +0930, skrev Adam Luchjenbroers:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Just noticed that there are multiple calls being made to MSACM32_LibMain(),
> 
> Most of these are with fdwReason as DLL_THREAD_ATTACH or DLL_THREAD_DETACH. 
> There are 11 attach calls and 10 detach calls in total (odd, I'd expect there 
> to be the same count of attach and detach calls).

Not necessarily. When ExitProcess is called, it sends a PROCESS_DETACH
message to all DLLs. Other threads do not receive additional
THREAD_DETACH messages, they are just terminated. This is how Microsoft
documents the behaviour of ExitProcess, so there is nothing abnormal
about this. It is assumed that the PROCESS_DETACH handler will clean up
any system resources allocated by the DLL, including those allocated in
other threads.

> I've noticed that the MSACM32_LibMain() does absolutely nothing when these 
> calls are received. Is this a potential problem? should thread specific 
> resources be allocated?

MSACM does not require any thread-specific resources.